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

All Knowing Sages,

Would it be possible to have two versions of Perl installed and functional on one system.

Thank you

Replies are listed 'Best First'.
Re: 2 Perls
by ikegami (Patriarch) on Jan 27, 2012 at 21:40 UTC
    I have a great number of Perl versions install on each of my systems. I use perlbrew to install them.
Re: 2 Perls
by Eliya (Vicar) on Jan 27, 2012 at 21:11 UTC

    Yes, this is certainly possible.  Basically, just put the installations into different directories.

    There are some details to be aware of, though (partly depending on the installation method, such as building yourself vs. installing pre-built versions, your platform, etc.).  For example, if you want completely independent installations, you should be aware that the default configure process would include compatible already existing Perl library directories in the default @INC of the respective newly built perl (see INSTALL (Coexistence with earlier versions...) ).

Re: 2 Perls
by JavaFan (Canon) on Jan 27, 2012 at 23:52 UTC
    Yes. I've several installations of perl on my system (ranging from 5.005_04 to 5.14.2), and each version I've build using different options.

    I typically use a different directory for each versions, but several builds (with different parameters) will happely live together in the same directory. I usually build my perls with and without threading, with 32 bit integers and with 64 bit integers and with debugging or no debugging support. That is, for many versions of perl, I have 8 different builds. I do rename the binaries though (so I have "perl32", "perl64", "perl32thr", "perl64thr", "perl32-d", "perl64-d", "perl32thr-d", and "perl64thr-d") foreach version.

Re: 2 Perls
by cdarke (Prior) on Jan 29, 2012 at 08:30 UTC
    Once installed (see others) you need to be careful when running, depending on the OS.

    In general, it is safer to specify the full path name to the perl executable required, to avoid running the wrong version, although I appreciate that is not always convienient.
    Consider use to indicate a minimum version in your programs

    On Windows, the file association system only allows one perl at a time to be associated with .PL. I suggest you create a .bat file which does the association (ASSOC and FTYPE commands) and have a desktop shortcut.

    On Linux/UNIX there is the #!/bin/env perl trick, which loads perl from $PATH, but that assumes your scripts are portable between releases. Personally I would hard-code the correct path. Don't forget the man pages. You can be mis-lead by reading the wrong version of the help text: altering MANPATH might be required.