[oak perl] beginning perl question

Kester Allen kester at gmail.com
Tue Dec 21 13:34:51 CST 2004


Hi Sandy--

If you rename your script hello.pl, and then associate the .pl
extension with your PerlIndigo executable, you should be able to run
that script by just typing "hello.pl" on the command line (or by
double clicking on it).

You can do this from the Windows Explorer by selecting Tools > Folder
Options, then selecting the "File Types" tab from the resultant popup.
 Click "New", type "pl" into the extention box, click OK, and then use
the "Details" to associate the executable to that extension.

When you type "perl hello", you're saying "run the perl interpreter,
and feed it the script named 'hello'".  In windows, you don't really
need the initial #!perl line, except to put a "-w" after it, and you
can do that with "use warnings" instead.

If you haven't been using the Indigo Perl for too long, I'd advise
uninstalling it and installing ActivePerl.  I've never used Indigo
Perl, but ActivePerl seems to be predominant in the windows world.

--Kester

On Tue, 21 Dec 2004 14:08:04 -0500, Sandy Santra <santranyc at yahoo.com> wrote:
> Hi, folks...  I'm a super newbie with a *very* beginning perl question.
> 
> I'm writing scripts with PFE 1.01 on a Win98 machine using PerlIndigo to
> execute them.  My perl program (I think version 5.6.1) is located in the
> "c:\pearindigo\bin" directory and I put a PATH statement in my autoexec.bat
> so that typing "perl" at a command line would allow Windows to find the
> program.  My scripts are stored in a directory of their own and I run them
> from a DOS window with the prompt set to the same directory.
> 
> What I'm confused about is (1) how to run the scripts, and (2) what goes in
> the first line of the script.
> 
> For example, if I type "perl hello" from the command line, the "hello"
> script executes.  Great.
> 
> Now the first line of said script is "#!perl".  If I *remove* said first
> line ("#!perl") and type "perl hello" again, the script *still*
> executes.  Why?  How can it work without that first line identifier?
> 
> If I type just "hello" from the command line, I get "bad command or file
> name," whether I have that first line or not.  (Is it possible to get
> *that* to work?  How?)
> 
> See, it's nice to know that I can omit that first line from my scripts (and
> I would love to know why), but what I'd really like is to be able to
> execute the script by just typing its name at the DOS window prompt without
> "perl" in front of it.
> 
> Sorry for such boneheaded questions.  Thanks in advance.
> 
> --Sandy Santra
> 
> _______________________________________________
> Oakland mailing list
> Oakland at mail.pm.org
> http://mail.pm.org/mailman/listinfo/oakland
>


More information about the Oakland mailing list