Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How do I read command-line arguments with Perl?
How do I read command-line arguments with Perl?
✍: Guest
With Perl, command-line arguments are stored in the array named @ARGV.
$ARGV[0] contains the first argument, $ARGV[1] contains the second argument, etc.
$#ARGV is the subscript of the last element of the @ARGV array, so the number of arguments on the command line is $#ARGV + 1.
Here's a simple program:
#!/usr/bin/perl
$numArgs = $#ARGV + 1;
print "thanks, you gave me $numArgs command-line arguments.\n";
foreach $argnum (0 .. $#ARGV) {
print "$ARGV[$argnum]\n";
}
2013-09-19, 2745👍, 0💬
Popular Posts:
What is NullPointerException and how to handle it? When an object is not initialized, the default va...
In which event are the controls fully loaded ? Page_load event guarantees that all controls are full...
What is difference between ADPATCH and OPATCH ? # ADPATCH is utility to apply ORACLE application Pat...
Why is it preferred to not use finalize for clean up? Problem with finalize is that garbage collecti...
In below sample code if we create a object of class2 which constructor will fire first? Public Class...