Solved

# to work on two versions of perl simultaneously

Posted on 2003-03-04
Medium Priority
250 Views
In my sysyem i have two versions of perl(5.6.1 and 5.8.0) installed in  two different paths.Now if i invoke a perl program i perl 5.8.0 is only invoked.How to invoke perl 5.6.1 if needed.Bcoz many of the modules in 5.6.1 is not present in 5.8.0.What is the reason for it.
0
Question by:vishnucharan
[X]
###### Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

• Help others & share knowledge
• Earn cash & points

Author Comment

ID: 8063112
0

LVL 6

Expert Comment

ID: 8063225
if you are under unix:
specify the path in the script-file using the shebang-line:

#!/your/path/to/perl58/perl

or, if you are using another os:
specify the fill path to the perl interpreter

\your\path\to\perl58/perl.exe script.pl

or, put a batch file around your script that sets a correct PATH variable for the script.

holli

0

Expert Comment

ID: 8063291
There you go... to elucidate...

The perl compiler/interpreter that you use to depends upon the path variable content set ($PATH in DOS). That is why your 5.6.1 version is being used to interpret your perl script. If you want to override this variable then you can do one of the following... 1. mention the path the interperter you want to use in your script's first line as #!<path to perl interpreter> 2. Interpret using the exact interpreter along with the fully qualified path.$ /bin/perl5.6.1/perl myscript.pl

Either way, you would be using that specific version you are mentioning and thereby can use multiple versions of perl.

Note: if you are using activeperl and are usign it from a dos environment, set the path to that directory that contains the reqd version of perl and you'd then be able to use the reqd version upon normal compile

0

LVL 26

Accepted Solution

wilcoxon earned 60 total points
ID: 8065328
On most OS that I've used you could also call it by

perl5.6.1 myscript.pl

and it will work as long as where you have perl 5.6.1 installed is in your \$PATH.
0

Expert Comment

ID: 8067889
Prefix your environmental PATH variable with full path to 5.6.1 version of perl.
0

## Featured Post

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…
A year or so back I was asked to have a play with MongoDB; within half an hour I had downloaded (http://www.mongodb.org/downloads),  installed and started the daemon, and had a console window open. After an hour or two of playing at the command …
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…
Six Sigma Control Plans
###### Suggested Courses
Course of the Month7 days, 23 hours left to enroll