Re: ARGV[] unable to pick up command line arguments



Niall Macpherson <niall.macpherson@xxxxxxxxxxxx> wrote in news:39f6e7b4-
c083-4203-bbcb-9f49369f06f6@xxxxxxxxxxxxxxxxxxxxxxxxxxx:

I've recently returned to using perl after a year or so away.

s/perl/Perl/

I therefore just tried running the following

use strict;
use warnings;
print "arg0=" , $ARGV[0], "\n", "arg1=", $ARGV[1], "\n";

No matter what I pass on the command line, single quoted , double
quoted or unquoted I never get anything in $ARGV[0] or $ARGV[1].

U:\PerlScripts>argv.pl "aaaaa" "ddddd"
Use of uninitialized value in print at U:\PerlScripts\argv.pl line 3.
arg0=
Use of uninitialized value in print at U:\PerlScripts\argv.pl line 3.
arg1=

The only command I can get to work is as follows

U:\PerlScripts>perl -le "print $ARGV[0]" "dddddddddd"
dddddddddd

U:\PerlScripts>

Having been away from perl for some time I guess I'm missing something
fundamental here. Perl is ActiveState 5.8.3

Most likely, this has nothing to do with Perl but with the fact that the
file association for .pl is not correctly set up (in the Windows
registry).

Make sure the following match the output of the same commands on your
system.

E:\> assoc .pl
..pl=Perl

E:\> ftype Perl
Perl="C:\opt\Perl\bin\perl.exe" "%1" %*

My guess is that on your system, the trailing %* will be missing. You
should be able to fix that. You can get help on the ftype command by
typing

E:\> ftype /?


Sinan


--
A. Sinan Unur <1usa@xxxxxxxxxxxxxxxxxxx>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/
.



Relevant Pages

  • Re: Wait for background processes to complete
    ... To be able to execute commands in the background and wait for their ... The documentation I am referring to is http://perldoc.perl.org/. ... You can run a command in the background with: ... There is a general problem with perl documentation: ...
    (comp.lang.perl.misc)
  • Re: Perl For Amateur Computer Programmers
    ... >professional computer programmers could use with the same ease as Basic. ... >Perl For Amateur Computer Programmers ... Also, taking into account that you're appealing to "scientists", it ... Also, as a side note, you seem to use the noun "command" in a naive ...
    (comp.lang.perl.misc)
  • Obtaining complete Unix command line that evoked script as string
    ... If there is a more appropriate list for this, let me know; the other perl lists I've seen seem to specialised for this. ... Note this is not just the arguments of the call to the script, but everything including pipes and redirects, etc., e.g. ... Ideally the perl interpreter would grab the complete command line as its evoked and I'd access this via a variable. ...
    (perl.beginners)
  • Thanks for the comments Jan. 25, 2006
    ... "shadow" operating system which is running behind Windows. ... Perl can then collect data from that program and do ... that by sending longer strings etc. to the Windows clipboard and then having ... SendKeysuse a Ctrl V command to paste the information to the text editor ...
    (comp.lang.perl.misc)
  • Re: debugger exiting
    ... strict and warnings pragmas. ... I think portraying Perl as a command-line tool limits it to fewer platforms than ... work only as a Unix shell command line. ...
    (perl.beginners)