• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 260
  • Last Modified:

to work on two versions of perl simultaneously

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
vishnucharan
Asked:
vishnucharan
1 Solution
 
vishnucharanAuthor Commented:
please be quick in answering the question
0
 
holliCommented:
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
 
yeeeooowwwCommented:
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
 
wilcoxonCommented:
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
 
sridharp999Commented:
Prefix your environmental PATH variable with full path to 5.6.1 version of perl.
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now