Solved

perl executable path in perl script - win

Posted on 2004-09-13
4
865 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
  • 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Email validation in proper way is  very important validation required in any web pages. This code is self explainable except that Regular Expression which I used for pattern matching. I originally published as a thread on my website : http://www…
There are many situations when we need to display the data in sorted order. For example: Student details by name or by rank or by total marks etc. If you are working on data driven based projects then you will use sorting techniques very frequently.…
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…

860 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