Re: Question about activestate perl
[email protected] ("Arno H.P. Reuser")
| Newsgroups | perl.perl4lib |
|---|---|
| Message-ID | <[email protected]> |
I think shift applies to an array, not to an argument. Try #!/usr/local/ActivePerl-5.8/bin/perl -w my $test = $ARGV[0] ; print "$test\n"; to read the first argument (hello) from the array ARGV Sincerely, Arno H.P. Reuser CEO, Reuser's Information Services KvK 2731 2325 ---- http://www.reuser.biz [email protected] Anne L. Highsmith wrote: > (Sorry if this is a duplicate. But I didn't see my first message distributed, so I'm re-sending from another address) > > This is REALLY embarrassing. > > After a loooooooooong hiatus, I need to go back to using activestate perl on my pc to do some work. I don't know whether it's me or my PC or the phase of the moon, but I can't get my program to recognize command line arguments. I backed off to the simplest program, i.e. > --------------------------------------------------------------- > #!/usr/local/ActivePerl-5.8/bin/perl -w > > my $test = shift; > print "$test\n"; > ---------------------------------------------------------------- > > and I invoke it from the dos window command line as: > > C:\Perl\apps\urls>test.pl Hello > > and I get: > > Use of uninitialized value in concatenation (.) or string at C:\Perl\apps\urls\test.pl line 4. > > What the HECK am I doing wrong? I've tried enclosing the command line arguments in single quotes, double quotes and rubber galoshes, but I get the same response. > I tried changing "my $test = shift;" to "my $test = $ARGV[0];". I copied the program back to my unix box, with just a change of the shebang line, and it works fine. > > When I hardcode the 'Hello' it works fine. > > I figure this has to be excruciatingly simple, but I can't see it. Help? > >