I have a perl script written for version 5.6.1 and which has dependencies on Oracle packages, DBI packages and more stuff. Everything is correctly installed and works.
Recently perl version 5.8.4 got installed and because those dependencies are not correctly set so the script fails.
‘perl’ command points to /program/perl_v5.8.4/bin/perl — latest version
So, when I have to run my perl script I have to manually specify in command prompt
/program/perl_v5.6.1/bin/perl scriptName.pl
I tried adding following lines in script:
/program/perl_v5.6.1/bin/perl
use v5.6.1;
But, this means script has to take Perl version > 5.6.1
I found couple of related question which suggested:
- To export path. But, I want the script for all the users without have to export path
- Specify version greater than. But, I want to use just one specific version for this script.
- use/require commands. Same issue as above.
My question: How to specify in the script to only use a specific version of perl?
The problem is that the interpreter specified in the shebang line (
#!/some/path/to/perl) is not used if perl script is called like this:perl some_script.pl… as the ‘default’ (to simplify) perl is chosen then. One should use the raw power of shebang instead, by executing the file itself:
./some_script.plOf course, that means this file should be made executable (with
chmod a+x, for example).