Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to have two different Perl versions?

Tags:

perl

raku

Currently I have Perl 5.8.8. Can I update to Perl 6? I am using Red Hat Linux 5 OS. Is it possible to upgrade Perl on Red Hat Linux 5 or any other OS? If yes, how can I do that?

like image 457
Vicky Avatar asked Jul 24 '17 13:07

Vicky


2 Answers

I'll try to articulate an answer that addresses all your requests, HTH:

  • I wouldn't touch system Perl, because other system software might depend on a particular version. If you need a different version of Perl 5 for development, it's arguably better to install it in a controlled, isolated environment

  • To do so you can use tools like Perlbrew: with Perlbrew you can install distinct versions of Perl 5, and you'll be able to switch back and forth according to your development needs

  • You say you want to "update to Perl 6". Perhaps you noticed I wrote Perl 5 in the previous paragraphs. Perl 6 is not just a new version of Perl, but a profound evolution of the language: it stems from the same core principles, but it is quite different from its older sibling. Code written in Perl 5 won't run in Perl 6, for example

To sum up:

  • You can have both Perl 5 and Perl 6 on your system, but they are distinct languages
  • You can have multiple versions of Perl 5 using Perlbrew
  • I would suggest not to tamper with the version of Perl distributed with the OS
like image 93
larsen Avatar answered Oct 05 '22 12:10

larsen


Perl 5 and Perl 6 are really different languages that share a name. Installing Perl 6 will not overwrite your Perl 5. I'm guessing that you don't want Perl 6 and instead want the latest version of Perl 5 (v5.26 was just released). You might consider updating everything to something recently released, including your OS ;)

If you're curious what your package manager is going to install, you can see the list. Perhaps How to list the contents of a package using YUM? is interesting for you.

Aside from the system's installed Perl 5, you can download, compile, and install other versions of Perl5 to any location you like. I have all the perls installed, for example, and the system perl is still there.

like image 39
brian d foy Avatar answered Oct 05 '22 13:10

brian d foy