nimdokk has asked for the wisdom of the Perl Monks concerning the following question:

I'm working on porting some code that I created on Unix to ActivePerl on Windows 2000. I'm testing out the chunks that I need and in the process have run into a problem of sorts. I'm attempting to access @ARGV and the test program keeps coming back that the @ARGV array is empty.

use warnings; my @rray=(1,2,3,4,5); print "\@ARGV is @ARGV\n"; print "\@rray is @rray\n"; __END__ C:\temp\Perl>test2.pl 1 2 3 4 5 @ARGV is @rray is 1 2 3 4 5 C:\temp\Perl>
Does anyone have any thoughts as to where the problem might be? The version of Perl that we have is 5.6.0 build 613. Thanks.


"Ex libris un peut de tout"

Replies are listed 'Best First'.
Re: Problem with @ARGV in Win32 Perl
by blokhead (Monsignor) on Jul 24, 2003 at 20:18 UTC
    I'd be willing to bet that the following would work as you expect:
    C:\temp\Perl>c:\path\to\perl.exe test2.pl 1 2 3 4 5 ^^^^^^^^^^^^^^^^^^^
    The problem is likely in the way .pl files are associated with the perl interpreter. It looks like at least on NT, you need to do:
    ASSOC .pl=PerlScript FTYPE PerlScript=c:\path\to\perl.exe %1 %*
    If you had forgotten the %* part, perl would never receive the additional arguments to pass to your script.. YMMV with Windows 2000, though.

    blokhead

      Make that:

      FTYPE PerlScript=c:\path\t­o\perl.exe "%1" %*
      so that it works when clicking on Perl scripts who have spaces in their path/name. And that is correct for Win2k.

                      - tye
      OK, that gives me a good idea what to fix. Thanks.


      "Ex libris un peut de tout"