View Single Post
  #2 (permalink)  
Old 11-18-2007, 10:05 PM
ragavraj ragavraj is offline
D-Web Programmer
 
Join Date: Feb 2007
Posts: 92
ragavraj is on a distinguished road
Default Re: How do I read command-line arguments with Perl?

In Perl command line argumnet are stored in @ARGV array

$ARGV[0] contains the first argument, $ARGV[1] contains the second argument, etc

Here is simple program for reading a n number of command line Inputs

PHP Code:
#!/usr/bin/perl
#---------------------#
#  PROGRAM:  commandlineinput.pl  #
#---------------------#

foreach $argnum (.. $#ARGV) 
{
  print 
"$ARGV[$argnum]\n";

Reply With Quote