- Perl Arguements
- Posted by Paul on September 8th, 2003
I am having difficulty in getting the Perl Interpretor to recognize
arguements submitted with a perl script.
For example,I have a simple perl script like this called temp.pl
print "ARGV0 : $ARGV[0]\n";
print "ARGV1 : $ARGV[1]\n";
print "ARGV2 : $ARGV[2]\n";
If I run the script as 'temp.pl A B C',I get the following output:
ARGV0 :
ARGV1 :
ARGV2 :
If I run the script as 'perl temp.pl A B C', the arguements are then
recognized and I get the following output:
ARGV0 : A
ARGV1 : B
ARGV2 : C
I do not understand why the difference, the perl scripts is running in
both cases, but in the first case no arguements seem to be recognized.
Thanks for any help,
Paul
- Posted by Programmer Dude on September 10th, 2003
Paul wrote:
Are you doing this in Windows?
If so, in the first case, Windows is looking at the .pl extension
and invoking perl and passing the scriptname as the first argument.
In the second case, you are explicitly creating the command line.
Chances are the invoking command (in the Registry) looks like this:
"C:\Perl\Bin\perl.EXE" "%1"
The additional arguments are not passed. If you change that to:
"C:\Perl\Bin\perl.EXE" "%1" %*
They should be.
--
|_ CJSonnack <Chris@Sonnack.com> _____________| How's my programming? |
|_ http://www.Sonnack.com/ ___________________| Call: 1-800-DEV-NULL |
|_____________________________________________|___ ____________________|
- How do I run a perl command on my web host? (Computers & Technology) by vbMark
- How do I install Perl in WinXP? (Computers & Technology) by Bob
- using perl as a find/replace (Computers & Technology) by Ben Wylie
- OpenOffice.org Perl Library 0.1.4 (Software & Applications) by Gordon Darling
- CGI/Perl form Help!! (Programming) by Tone Southerland

