MC logo

Args IV

  Code Examples

<<Args III: The Foreach Loop args4.pl Args V>>
# And, yet another way to print the command-line arguments.  This uses the
# shift operator, which removes the first member of the array and returns
# it.  After the loop is finished, the array is empty.
while($item = shift @ARGV) {
    print "$item\n";
}
print "[@ARGV]\n";
<<Args III: The Foreach Loop Args V>>