Mega Code Archive

 
Categories / Perl / Language Basics
 

ARGV in Perl represents the command-line arguments

#  <ARGV> represents opening each file that is listed by name on the command line.  #  @ARGV is a Perl array that contains each of the command-line arguments as a separate array element. #!/usr/bin/perl -w # Lists command-line arguments. # Get first argument. $arg = shift(@ARGV); # Loop while there is an argument. while (defined $arg) {     print "$arg\n";          # Get next argument.     $arg = shift(@ARGV); }