Solved

perl executable path in perl script - win

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

I've just discovered very important differences between Windows an Unix formats in Perl,at least 5.xx.. MOST IMPORTANT: Use Unix file format while saving Your script. otherwise it will have ^M s or smth likely weird in the EOL, Then DO NOT use m…
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…
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

777 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