Pop value out of array
#!C:/perl/bin
@passengerships = ('T', 'O', 'B');
print "\n\n@passengerships \n\n"; #print the array values
push(@passengerships, "QE2"); # add another ship
print "@passengerships \n"; # print the array values again
$poppedstring = pop(@passengerships);
print "$poppedstring\n"; # This is the value we popped!
print "@passengerships \n"; # print the array values again
Related examples in the same category