Re: Question about activestate perl--closed
Mark Jordan and Leif Andersson have pointed me in the right direction. It appears to be a problem with the file folder associations. c:\perl\bin\perl.exe test.pl Hello works, but test.pl Hello doesn't Yet it is weird. 'Cause when the 'Hello' is hardcoded inside the file, it works fine. Oh well, thanks folks. Will pursue this with my local PC support gurus. Anne L. Highsmith Consortia Systems Coordinator 5000 TAMU Evans Library Texas A&M University College Station, TX 77843-5000 [EMAIL PROTECTED] 979-862-4234 979-845-6238 (fax)
Re: Question about activestate perl
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 loong 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?
Re: Question about activestate perl
Mark Jordan wrote: Or, you can remove the shebang totally and run perl anne-test.pl Woops, I meant: perl anne-test.pl foo which will print 'foo'. Mark
Re: Question about activestate perl
Hi Anne, Your script works (on my WinXP instance of ActivePerl anyway) when you replace the unix-style shebang line with the windoze equivalent, e.g., #!c:\perl\bin\perl.exe -w my $test = shift; print "$test\n"; Or, you can remove the shebang totally and run perl anne-test.pl Mark 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 loong 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? -- Mark Jordan Head of Library Systems W.A.C. Bennett Library, Simon Fraser University Burnaby, British Columbia, V5A 1S6, Canada Voice: 778.782.5753 / Fax: 778.782.3023 [EMAIL PROTECTED] / http://www.sfu.ca/~mjordan/
Re: Question about activestate perl
On Tue, Apr 22, 2008 at 8:25 PM, Anne L. Highsmith <[EMAIL PROTECTED]> wrote: > --- > #!/usr/local/ActivePerl-5.8/bin/perl -w > > my $test = shift; > print "$test\n"; > > I don't know if I'm getting what you want to achieve. But this works in my installation of ActiveState Perl: my $test = <>; print "$test\n"; I think $ARGV() is used for command line parameters. -- Saiful Amin +91 9343826438