Parsing command-line arguments in Perl is very easy.
All the command-line arguments are present in the array $ARGV. You can get the number of arguments passed as ( $#ARGV + 1 ).
Below is a sample Perl script to read the command-line parameters.
#!/usr/bin/perl
#-------------------------------------------------#
# File: argv.pl #
# Author: Dipin Krishna [email protected] #
#-------------------------------------------------#
# The commandline arguements are present in the variable $ARGV.
$numberofArgs = $#ARGV + 1;
print "The $numberofArgs command-line arguments are:\n";
foreach $argnum (0 .. $#ARGV) {
print " $argnum.\t$ARGV[$argnum]\n";
}