newbie_176 has asked for the wisdom of the Perl Monks concerning the following question:

I am a newbie to the world of Perl:-) I am confused about what takes precedent when a script is compiled. ISSUE: At my site we have two version of Perl loaded on an AIX box. Perl 5.8.0 is loaded on /usr/local/bin/perl. Perl 5.005_3 is loaded on /usr/bin/perl. The first line of the Perl script contains the #!/usr/bin/perl command. However, when the script is compiled, the command line has the following: perl5.8.0 scriptname.pl. Which version of perl will the be used to compile the script? Please advise.

Replies are listed 'Best First'.
Re: What version takes precedent
by dragonchild (Archbishop) on Oct 01, 2003 at 13:58 UTC
    Whatever is on the commandline will be used, if there's something there. If there's nothing on the commandline, the shell will look for the #! (she-bang) line and use that. So, the answer is Perl5.8.0.

    I've run into this before in the other direction. I used to have V mapped to ":!perl %" in vi. I have 5.6.0 and 5.8.0 installed on my AIX box. When I needed to use 5.8.0, I have "#!/usr/bin/env perl5.8.0" as my she-bang line. But, my kepmap went to the 5.6.0 version, causing issues. (Cause DBD::Oracle going to Oracle9i only works for Perl5.8.0 on AIX.)

    ------
    We are the carpenters and bricklayers of the Information Age.

    The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.