Solved

perl executable path in perl script - win

Posted on 2004-09-13
4
848 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
Comment Utility

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
Comment Utility
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
Comment Utility
Tintin,

Is this same for UNIX also ..

Shirish
0
 
LVL 48

Expert Comment

by:Tintin
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

743 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