argstest.pl Hello ... New build is 64-bit Perl28 from ActiveState.
Check your file association for perl*. My guess is it's just running c:\path\to\perl.exe "%1". If that's the case, then none of your other command-line arguments are being passed to argtest.pl, hence the ARGV is undefined. You want the association to be something like c:\path\to\perl.exe "%1" %*, where the %* passes the remaining command-line arguments to the script.
FOOTNOTE *: sometimes assoc .pl then ftype perl_auto (replace perl_auto with the results of the assoc). If not there, run regedit, then search either HKEY_CLASSES_ROOT\.pl or HKEY_CURRENT_USER\Software\Classes\.pl, look in the "(Default)" item, which will tell the name of the class (might be perl_auto; on my system, since i manually associated, it's called PerlScript); then at the same level as .pl, search for a key (folder) with that name, then dig into the ...\shell\xxx\command\(DEFAULT), where xxx will be "run" or "open" or some such.
update: haukex's suggestion of "Have you tried running perl argtest.pl Hello" would lend further strength: if that command works, but the auto-associated run does not, it's almost certainly the file association.
| [reply] [d/l] [select] |
That code should work fine no matter the Perl version. Since you're getting a warning, I doubt that is your full test script - can you show an SSCCE? I suspect there is a difference between your two machines and/or in how Perl is set up. What's the Perl version on your old machine? What are the Windows versions of both machines, and are you using cmd.exe on both? Have you tried running perl argtest.pl Hello?
| [reply] [d/l] [select] |
I must thank haukex and pryrt for excellent help. The line was missing %* at the end. I added it in with regedit. All works fine now. Thank you thank you.
| [reply] |
Here's the entire argstest pgm, all 5 lines:,
use 5.012;
use strict;
use warnings;
#use diagnostics;
print "\n\$ARGV[0] = $ARGV[0]\n";
This works fine:
perl argstest.pl Xxx
assoc .pl says file extension not found. regedit says .pl default is pl_auto_file and then for that it says
"C:\Users\Thomas\perl\Perl64\bin\perl.exe" "%1"
I don't recall seeing
%*at the end of that. Will check again.
The old machine runs Perl5.12. The new one Perl28.
| [reply] [d/l] [select] |
ASSOC .pl=PerlScript
FTYPE PerlScript=perl.exe %1 %*
| [reply] [d/l] |