to work on two versions of perl simultaneously

Posted on 2003-03-04
Medium Priority
Last Modified: 2010-03-05
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.
Question by:vishnucharan
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
  • Learn & ask questions

Author Comment

ID: 8063112
please be quick in answering the question

Expert Comment

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


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.



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

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.

Expert Comment

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

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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

765 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