Perl does not see command line arguments

Posted on 2014-01-02
Last Modified: 2014-01-11
I am rehosting my Perl programs from Windows 7 to 8.1.  All is well except that my perl scripts do not detect any command line parameter.  Here is my assoc command

 C:\ODpair>assoc .pl

C:\ODpair>ftype Perl
Perl="C:\Perl\bin\perl.exe" "%1" %*

I appreciate any help to resolve this from you experts.
Question by:cpeters5
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
LVL 28

Expert Comment

ID: 39751476
Having an ftype entry is not required and in my case Perl is not listed in ftype.

What is required is having the proper registry entry under HKEY_CLASSES_ROOT.

Open regedit and navigate to the Perl entry and inspect its layout and value for the command param.  In my case it's actually under HKEY_CLASSES_ROOT\Perl_program_file.

Here's the complete exported key from my system.
Windows Registry Editor Version 5.00

@="Perl program file"


[HKEY_CLASSES_ROOT\Perl_program_file\shell\Execute Perl Program]

[HKEY_CLASSES_ROOT\Perl_program_file\shell\Execute Perl Program\command]
@="\"C:\\strawberry\\perl\\bin\\perl.exe\" \"%1\" %*"
LVL 28

Expert Comment

ID: 39751484
After checking and possibly fixing the registry entry, see if you get the same output from this test.

c:\test>perl -e "print $_,$/ for @ARGV" 1 2 3

Author Comment

ID: 39752453
No luck.  Attached is my regedit screen

Note: I just reinstalled version 5.18 in c:/perl64/.  No luck there either.

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  


Author Comment

ID: 39752626
If I run my script with perl command.  I.e.
c:>perl 123 456
Then detected @ARGV = (123,456);

This suggests the problem is the file type association...

Here is the .PL assoc again

C:\>assoc .pl

LVL 28

Expert Comment

ID: 39753956
Which distro did you install, Activestate or Strawberry, or some other one?

Your print screen shows that you still have the reg entry of the first perl installation.  Did you uninstall the old perl before installing the new version?

My guess is that the reg entries of the 2 installations are conflicting with each other.  Can you expand the other reg entry and post the print screen of it?
LVL 28

Expert Comment

ID: 39753965
It also appears that you have PerlScript installed, which is Microsoft's implementation (port) of perl.  That could also be conflicting with your other installation.

Author Comment

ID: 39773315
There were 3 versions installed.  I uninstall all three, all keys removed.  Then install fresh Perl 5.18.
After the installation, I activated ppm.  It detected only the 276 installed packages.  But this time, no error output as before.

Do you detect any problem in the attached screenshot for: regedit, ppm screen and Perl -v?

Also, do you have suggestion for a work around?  I have immediate need for a few modules such as DateTime, Location::GeoLoc, XML::Simple and some math::stuff

LVL 28

Expert Comment

ID: 39773338
Everything looks good in your screenshot.

Are your scripts now able to see the command line args?  If so, then you should be fine and no "work around" would be needed.

Have you tried installing any of those modules?  If so, did they install properly or did they fail and produce error messages?
LVL 28

Accepted Solution

FishMonger earned 500 total points
ID: 39773357
You'll want to add a few additional repositories to ppm.

Personally, I've moved away from using ppm and instead install all of my modules via cpan.  You first need to install MinGW-w64 to get the needed GCC compiler.

You might be able to install that via ppm.  At least it was available in the 32bit version.  I'm not sure if it's available in the 64bit version of ppm.

Author Closing Comment

ID: 39773748
Took me a while to find the right MinGW-w64 that works.
Thanks FishMonger.

Featured Post

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
PERL - Find newest folder 12 166
Perl regex to replace any capital letters not preceded by ">" 6 160
perl: Cleaning meta tags using RegEX 12 86
Perl Snippet to Parse String 1 34
The Samsung SSD 840 EVO and 840 EVO mSATA have a well-known problem with a drop in read performance. I first learned about this in an interesting thread here at Experts Exchange:…
No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question