Link to home
Start Free TrialLog in
Avatar of s_more
s_more

asked on

perl executable path in perl script - win

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
ASKER CERTIFIED SOLUTION
Avatar of Tintin
Tintin

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of gripe
gripe

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.
Avatar of s_more

ASKER

Tintin,

Is this same for UNIX also ..

Shirish
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.