Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Is my @ARGV broken?

by ibanix (Hermit)
on Jan 17, 2003 at 22:24 UTC ( [id://227827]=perlquestion: print w/replies, xml ) Need Help??

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

I seem to be having some trouble with a ActivePerl installation. In particular, it doesn't seem to handle @ARGV correctly. Here's my test code:
use strict; use warnings; my $first = shift(@ARGV); my $second = shift(@ARGV); my $third = shift(@ARGV); print "$first\n"; print "$second\n"; print "$third\n";
On this server, running it looks like this:
D:\argv_test.pl I like code I like code D:\
On the other hand, it works as expected on my workstation:
C:\>argv_test.pl I like code I like code C:\>
Both installations are vanilla ActivePerl v5.6.1.
Any ideas?

Thanks!
ibanix
$ echo '$0 & $0 &' > foo; chmod a+x foo; foo;

Replies are listed 'Best First'.
Re: Is my @ARGV broken?
by rbc (Curate) on Jan 17, 2003 at 22:43 UTC
        Well, this was definately the related problem.

        I changed the ftype to the full path to perl.exe, and hey presto, it works as expected:

        ftype perl=D:\perl\bin\perl.exe %1 %*
        Ever feel dumb? I sure do! I even wrote a tutorial on this! Doh!
        Thanks for the help!

        ibanix

        $ echo '$0 & $0 &' > foo; chmod a+x foo; foo;
        Interesting. I had set mine up previously. Here's what it looks like:

        D:\>assoc .pl .pl=perl D:\>ftype perl perl=perl.exe "%1" "%*"
        ibanix

        $ echo '$0 & $0 &' > foo; chmod a+x foo; foo;
    Re: Is my @ARGV broken?
    by ibanix (Hermit) on Jan 17, 2003 at 22:45 UTC
      Update:
      I just tried this:
      D:\argv_test.pl "I like code" I like code D:\
      So it only works with double quotes now?

      ibanix

      $ echo '$0 & $0 &' > foo; chmod a+x foo; foo;
    Re: Is my @ARGV broken?
    by Marza (Vicar) on Jan 17, 2003 at 22:39 UTC

      Wierd! I ran it on a w2k server and it displayed right! But that was with 5.8.0

    Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Domain Nodelet?
    Node Status?
    node history
    Node Type: perlquestion [id://227827]
    Approved by data64
    help
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this?Last hourOther CB clients
    Other Users?
    Others surveying the Monastery: (5)
    As of 2024-04-25 10:44 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found