Greetings;

Are you using ActiveState perl?

I just did extensive testing using ActiveState perl on XP-Pro
and I get the exact same results.

        C:\DATAFI~1>argv.pl testfile

gives the unitialized variable message but

        C:\DATAFI~1>perl argv.pl testfile

works as expected.

I also tested with cygwin perl and the results were also as
expected so this appears to be a bug in ActiveState perl.

So, this is a good news / bad news thing; your code is OK,
but AS perl is broke! Take this over to the ActiveState perl
list and see if anyone has an answer or even knows about it.

(I just tried to look up the address but the AS perl web
page is broken at the moment! Go to
http://www.activestate.com/
and look for "Mailing lists" on the right side.)

Good Luck!
Dennis



On Thu, 3 Jun 2004, Jeff 'japhy' Pinyan wrote:

> Date: Thu, 3 Jun 2004 08:29:45 -0400 (EDT)
> From: Jeff 'japhy' Pinyan <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> To: Larry Wissink <[EMAIL PROTECTED]>
> Cc: [EMAIL PROTECTED]
> Subject: Re: Confused about supplying command line arguments and using
>     @ARGV
>
> On Jun 2, Larry Wissink said:
>
> >I want to supply the name of a file on the command line when executing a
> >script.  Unfortunately, I'm getting an error that says that @ARGV is
> >uninitialized.
> >
> >How do you initialize @ARGV?  How do you specify command line arguments?
>
> You don't initialize @ARGV.  It gets whatever arguments are passed to your
> program.  You send your program arguments by placing them after the
> program name.
>
> >C:\Perl\my_scripts>argv_test.pl cookies.txt
>
> Have you tried calling it as
>
>   perl argv_test.pl cookies.txt
>
> I'm just curious because I don't trust Windows.
>
> >use warnings;
> >
> >#push @ARGV, "cookie.txt"; # when uncommented script works fine.
> >
> >my $name =  $ARGV[0];
> >print $name;
> >
> >open (INFILE, $name);
> >while (<INFILE>) {
> >  print $_;
> >}
> >close INFILE;
>
> That code looks ok to me.
>
>

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to