Solved

perl executable path in perl script - win

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sending email via Perl on Windows 3 138
Perl, group, sort, count question 6 117
Migrate OTRS to newest version. 1 312
Union rows in array that have common elements 2 89
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…
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…
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…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

911 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now