```{index} single: unshift (DB_File) ``` ```{index} single: DB_File::unshift ``` # unshift Put elements at the start of a `$DB_RECNO` array, in the order given. ## Synopsis ```perl $db->unshift('first', 'second'); unshift @lines, 'header'; ``` ## What you get back 0, or the error of the element that could not be stored - the elements after it are not stored either. `UNSHIFT` is the same method under the name the tied array calls. ## Edge cases - An empty array cannot be unshifted onto: nothing is stored, and the method returns 22 (`EINVAL`). `push` the first element instead. - The elements go before the first element that holds a value, after any empty ones created by storing past them. - It moves the database's cursor to the first element stored. ## Differences from upstream Fully compatible with upstream, edge cases included. Covered by `t/81-xs-native/DB_File/010-phenotype.t`. ## See also - `push` - the other end of the array - `shift` - takes the first element off again