http://qs321.pair.com?node_id=11101507


in reply to Re^7: Sort alphabetically from file
in thread Sort alphabetically from file

so shift physically removes the entry in @ARGV? this is interesting and i did not realize that

Indeed it does:

$ cat shifter.pl #!/usr/bin/env perl use strict; use warnings; do { print "ARGV is @ARGV\n"; print "Shifting " . shift . " off ...\n"; } until $#ARGV < 0; $ ./shifter.pl x y z ARGV is x y z Shifting x off ... ARGV is y z Shifting y off ... ARGV is z Shifting z off ... $

See perldoc -f shift for more.