in reply to It's the little things...

I found that all this time I was typing perl filename.pl could have just been typed filename.pl.

Depending upon how your perl was install, you may find that you can just type filename to run your perl scripts.

A way to check this (beyond just trying it), is to run the following command:

c:\test>set pathext PATHEXT=.pl;.COM;.EXE;.BAT;.CMD;;.wlua;.lexe

If .pl appears in the output (not necessarially at the beginning), then you probably can. To further check, try:

c:\test>assoc .pl .pl=Perl

And then:

c:\test>ftype Perl Perl="C:\perl64\bin\perl.exe" "%1" %*

And what all that tells you is that .pl is accepted as the extension for executable files. So, if you type filename, and there is a file called filename.pl in your path, then .pl will be looked up in the associations, (to find "Perl"), and that will be looked up in the ftype database and the command template found there will be used to construct the command that will be executed.

Hence, if I type filename, the command "c:\perl64\bin\perl.exe" "filename.pl" will be executed.

(I never understood why there is a two-stage lookup. There doesn't appear to be any way to have anything other than a one-to-one mapping. But that's how it is.)


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"I'd rather go naked than blow up my ass"

Replies are listed 'Best First'.
Re^2: It's the little things...
by Jenda (Abbot) on Mar 02, 2010 at 23:05 UTC

    You can have several extensions associated to the same "type". Try "assoc .htm" and "assoc .html". Most likely they will be the same. And since you can actually set up several actions for a file type, it makes sense to allow this additional level of indirection.

    Jenda
    Enoch was right!
    Enjoy the last years of Rome.