tags:

views:

277

answers:

5

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

+10  A: 

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.

fennec
Beta version of ready-for-install Perl6 was released yesterday.
Alexandr Ciornii
Which version of Perl6? There are so many branches floating around.
vol7ron
Rakudo Star is more of a technology demonstrator than a beta. Its got more to go before they even declare an alpha. http://rakudo.org/announce/rakudo-star/2010.07
Schwern
@fennec: please have some clue what you are talking about before making such statements
ysth
@ysth - Mmm, which statements? "N years until Perl 6 is actually *out*"? Nobody knows how long it's going to be until there's an official release of Perl 6. The FAQ readily admits this. You might take issue at my lack of clarity in differentiating between experimental/early-adopter software like Rakudo and "actually *out*", but dismissive instructions to 'please have some clue' seem a little bit strong.
fennec
The "N years". My comment had nothing to do with the early-adopter release. IMO the chances of it not being *out* in under 2 years are miniscule.
ysth
+13  A: 

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.

toolic
and it's worth emphasizing they are different languages, not different versions of the same language
ysth
+15  A: 

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.

hobbs
Commenting on my own post: some day hopefully we'll get that p5/p6 interop that we were promised, and you'll be able to use the whole Perl 5 CPAN from Perl 6, and that will be a great day for both languages. But we're still in very early days, there :)
hobbs
+2  A: 

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.

vol7ron
While there will be a translator, I doubt it will be good enough to reliably translate a large production system. I have no idea how they'll handle XS, which is poorly understood, tested and documented as it is. The more reliable approaches employ the existing Perl 5 interpreter. Either Perl 5 is embedded in Perl 6 or Perl 6 is translated to Perl 5 (aka 6on5). AFAIK all three approaches are being pushed forward.
Schwern
I don't know who you're quoting in your first sentence. Larry Wall floated the idea of an overhaul of the Perl language in 2000 at a conference and began accepting RFC's for the specification then, but tangible development of any serious implementation didn't begin until around 5 years later. The difference might be semantic but Rakudo hasn't been in development for a decade, and from thinking so or failing to note the distinction one would draw the wrong conclusions about the rate of its progress.
cikkle
**@cikkle:** do auto-quotes count? :) -- You are correct though, the language was announced in 2000 and Larry started accepting and grouping RFCs then. I think Masak's historical account is close to accurate (http://use.perl.org/~masak/journal/40451). Like you, he gives 2005 as the magical date that things started, but really there was some push in late 2002, up to that point. Still, it's been a lonnnng time to develop an already mature language, even if most of it was rewritten. FYI, a little unrelated cool look at Perl's history: http://www.youtube.com/watch?v=jl9HVEJl_-w
vol7ron
@Schwern I wouldn't be surprised if you could get a lot of traction with a solution that did 5-to-6 translation, using *reimplemented versions* of the most common XS-using modules, and simply marking the rest unsupported. That'd be a solution for a much later stage of the game than we're in right now though :)
hobbs
@hobbs Having experience emulating large, old modules (see DBIx::Class::CDBICompat) I can tell you that its never right enough. And that's in pure Perl. Even if you get all the documented features right, people will be using very subtle undocumented ones in large, commercial code bases. Emulating something like DBI and all its drivers is a Sisyphean prospect. In the end, it has to work perfectly and its all or nothing or the risk will be too great for a large project to switch. See also the problems Python 3 has been having.
Schwern
A: 

I would recommend learning Perl5 before learning Perl6, for several reasons.

  • There are more books on writing Perl5 programs than Perl6 programs.
  • There is just more information for programming in Perl5 than for programming Perl6.
  • Perl6 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 Perl5 modules, while there are only a relatively small number of Perl6 modules.
    • CPAN
    • Most of the modules for Perl6 are currently just reimplementations of Perl5 modules.
  • Perl5 isn't going to go away.
    • Most of the current versions of the Perl5 language have come out after work on the Perl6 specification started.
    • Arguably Perl6 saved Perl5.
Brad Gilbert