shift#

Remove the first element of a $DB_RECNO array and return it; the others move down one.

Synopsis#

my $first = $db->shift;
my $line  = shift @lines;

What you get back#

The element’s value, or undef for an empty array. SHIFT is the same method under the name the tied array calls.

Edge cases#

  • Empty elements at the start are passed over: it removes the first element that holds a value, and the empty ones stay.

Differences from upstream#

Fully compatible with upstream. Covered by t/81-xs-native/DB_File/010-phenotype.t.

See also#

  • pop - the same at the end of the array

  • unshift - puts elements back at the start