Question

I've been thinking about learning Perl. Should I learn Perl5 or start with Perl6?

Was it helpful?

Solution

Perl5.

If you're willing to do all-new development and can wait N years until Perl 6 is actually out, you can learn Perl 6. But really, Perl5.

edit to clarify: Rakudo Star, a

useful, usable, "early adopter" distribution of Perl 6

has recently garnered some attention, but it's not complete or final, and it's not really ready for deployment in a production environment. If you're looking for a new job in the next year or three, it's unlikely to help you get that job. Perhaps most importantly, if an enterprise is interested in Perl 6, chances are it's got some Perl 5 infrastructure too, and you would be better prepared to understand it by learning Perl 5 and its limitations first before you learn a significantly newer language like Perl 6.

If you're just looking for "fun" you may indeed prefer Perl 6... or you may prefer the much more available Perl 5 and its wide variety of prepackaged modules available via CPAN.

There is no release date for Perl 6.

OTHER TIPS

Perl 5 if you want CPAN, Perl 5 if you want acceptable runtime performance, Perl 5 if you want stability and a language that's complete. Perl 6 if you want to play with the world's niftiest toy.

Of course, they're not mutually incompatible -- I write Perl 5 for pay and for most of my "serious" open-source work, and Perl 6 for fun. But I've been writing Perl for long enough that I'm comfortable enough with Perl 5 to switch gears and write Perl 6 in my spare time.

But for someone just starting out, of course you want to focus on just one language, and that language should be Perl 5 for most practical purposes. Perl 5 is not going to die anytime in the next 10 years, no matter how much success Perl 6 enjoys, and even though Perl 5 and Perl 6 are definitively different languages, still a lot of what you learn from Perl 5 will help you get started with Perl 6 if you choose to learn it in the future.

Here is a quote from the Perl6 webpage (emphasis is mine):

Perl 5 and Perl 6 are two languages in the Perl family, but of different lineages. If you are looking for production ready code please use Perl 5.

Perl5 is mature. Perl6 is in development.

There are several reasons for recommending learning Perl 5 before learning Perl 6.

  • There are more books on writing Perl 5 programs than Perl 6 programs.
  • There is just more information for programming in Perl5 than for programming Perl 6.
  • Perl 6 is still in the process of being designed. Which means that some of the things you would learn now, might not be applicable later.
  • There are many quality Perl 5 modules, while there are only a relatively small number of Perl 6 modules.
    • CPAN
    • Most of the modules for Perl 6 are currently just reimplementations of Perl 5 modules.
  • Perl 5 isn't going to go away.
    • Most of the current versions of the Perl 5 language have come out after work on the Perl 6 specification started.
    • Arguably Perl 6 saved Perl 5.

There are also a few reasons for recommending Perl 6 over Perl 5.

  • It has been redesigned so that different things look different, and similar things look similar, to a much greater extent.
  • Parallelism has been designed into the language
  • Many arguably conflicting paradigms have been combined in a way that feels as if they were just some part of a whole.
  • Nicer default object system
    ( Moose/Moo/etc in Perl 5 is great too, and have been copied to other languages )
  • There are fewer special cases.
  • There are more ways to express your ideas, which allows you to choose one that is easier to read.
  • Meta operators
  • Normal operators are just subroutines, which allows you to add new ones, and extend existing ones.
    ( don't use existing operators for things they weren't designed for, add new ones )

Perl6 has been in development since July 2000. You decide if you want to wait on it.

Perl5 is still suggested for production code and has a large support community, though, as a testament to Perl6, if you encounter problems, it is more likely to be from new additions to the language, not those things that were in Perl5.

Once Perl6 is "released", Larry Wall and others have created a translator, which will convert most (if not all) the Perl5 code into Perl6 syntax, if that helps in your decision.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top