```{index} single: upd_data (PDL) ``` ```{index} single: PDL::upd_data ``` # upd_data Tell the ndarray that the scalar `get_dataref` returned was changed. $pdl->upd_data; # after writing into the scalar $pdl->upd_data(1); # after replacing the scalar's buffer Any views derived from `$pdl` are told their parent changed, so they see the new data. For a small ndarray, whose scalar is a copy, the bytes are copied back and the scalar is released; a true argument keeps the scalar and makes it the ndarray's data instead. For an ndarray whose data is the scalar, the ndarray is pointed at the scalar's buffer again - which is what makes a buffer that moved, such as one a file was mapped into, take effect. Croaks with `Trying to touch dataref of magical (mmaped?) pdl` for an ndarray whose data is owned elsewhere, and with `Trying to upd_data but datasv now length N instead of M` if a small ndarray's scalar was resized.