If your a perl programmer on Windows and find yourself running perl programs from the CLI (Command Line Interface) and get annoyed by having to run perl foo.pl all the time, then this is for you.
You don't have to do this if your running Windows NT 4/5 (2000) because theres a way round it. There are two little programs called assoc and ftype. These programs allow tou to associate the .pl extension or any other extension you use with the perl interpretor. so when you want to run a program called foo.pl you can just type foo at the CLI, as long as its in your CWD (Current Working Directory) or your PATH.
All you will need to do is follow these steps.
1) Open up a CLI. and enter these commands:
C:\> assoc .pl=PerlScript
C:\> ftype PerlScript=C:\Path\To\Perl\bin\perl.exe %1 %*
2) While still in the CLI type this:
C:\> set PATHEXT=.pl;%PATHEXT%
The PATHEXT environment variable contains the extension(s) to executables. So by adding .pl to this anything (files) found with the .pl extension will be treated as executable. This will only last for your CLI session, so if you want to make this a permanent thing do the following:
1) Right click on 'My Computer' and select properties.
2) Move along to the Advanced tab.
3) Click on Environment Variables.
4) In the System Variables double click on PATHEXT.
5) Append a ';.pl' to the end or a '.pl;' to the beggining of the Vari
+able value box.
6) Click on all of the OK's and Apply's, restart your CLI and try it o
Added 'NT' to title per ntc request
Edit by tye to change PRE to CODE when around long lines.