8.9. shift, unshiftshift and unshift are working on the beginning (left side) of the array. Example 8-6. examples/arrays/shift_unshift.pl #!/usr/bin/perl
use strict;
use warnings;
my @names = ("Foo", "Bar", "Baz");
my $first = shift @names;
print "$first\n"; # Foo
print "@names\n"; # Bar Baz
unshift @names, "Moo";
print "@names\n"; # Moo Bar Baz
FIRST = shift ARRAY;
|