Solved

perl executable path in perl script - win

Posted on 2004-09-13
4
887 Views
Last Modified: 2010-08-05
All,

I'm new to perl..

For windows do we have to mention the perl executable path at the top of the script always -

#! <your perl executable here>

Shirish
0
Comment
Question by:s_more
[X]
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
  • 2
4 Comments
 
LVL 48

Accepted Solution

by:
Tintin earned 25 total points
ID: 12049723

The #! line is ignored by Windows, although any flags you use will be recognised by perl.

For example if you have

#!perl -w

The -w flag will be picked up.

The path makes no difference, you could have written

#!C:/some/path/perl -w

with the same effect.

On Windows systems, you generally set up file associations so that any .pl (for example) are recognised as Perl scripts.  Alternatively, you can call perl explicitly like:

perl myperlscript
0
 
LVL 13

Expert Comment

by:gripe
ID: 12057333
As TinTin mentions, the #! (shebang) line is recognised by perl to pick up command line flags, but if you're interested in using command line flags without typing the entire path to your perl script, you can shorten it up a bit by just using:

#!perl -flags

The entire path (drive letter, colon, path, executable) is not needed.. Just the word 'perl' followed by your flags.

Hope this helps save some time.
0
 

Author Comment

by:s_more
ID: 12058601
Tintin,

Is this same for UNIX also ..

Shirish
0
 
LVL 48

Expert Comment

by:Tintin
ID: 12060262
On Unix systems, the #! line is important, as it tells the Unix kernel how/what to execute the file with, so most Perl scripts on Unix systems start with

#!/usr/bin/perl

as /usr/bin is the usual directory where perl exists.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Many time we need to work with multiple files all together. If its windows system then we can use some GUI based editor to accomplish our task. But what if you are on putty or have only CLI(Command Line Interface) as an option to  edit your files. I…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
Six Sigma Control Plans

623 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