Clear questions and runnable code
get the best and fastest answer
Perl 5 <-> Perl 6 compatibility: a benefit or a mess?by citromatik (Curate)
|on Jun 18, 2007 at 15:45 UTC||Need Help??|
citromatik has asked for the
wisdom of the Perl Monks concerning the following question:
Recently I've been messing around with Pugs and Perl 6. AFAIK, Perl6 is not only an upgrade of Perl5, but a new language that starts from Perl 5 but that has a (notably) modified syntax and a bunch of new features. Like Corion said recently: The main thing wrong with Perl 6 is the name. It poses as a version upgrade like from Perl 4 to Perl 5, but it's a completely different language with largely incompatible syntax.
(For those that are not familiar with Perl 6 syntax, here is a small example of code extracted from Perl 6 documentation:)
More examples can be found in the Perl 6 cookbook
In this thread there is an interesting discussion about Perl 6
I noticed in the documentation that one can mix Perl 5 and Perl 6 code in the same script, for example:
Or even use Perl 5 modules in Perl 6 scripts, like:
Does this mean that all the modules available from CPAN for Perl 5 will be available for Perl 6 too without modification? This seems great for those of us that already know Perl 5, but if this is the case, when Perl 6 becomes available, those who are new to Perl and want to learn it, will have to learn 2 different languages instead of only 1 (Perl 5 + Perl 6), or they won't be able to understand all the Perl 5 stuff that is already done (and still in use in Perl 6 scripts). Am I completely wrong?
Surely, mixing Perl 5 and Perl 6 code will be a nice thing for those who already use Perl 5. But won't be a mess for those learning the basics of Perl? (I'm afraid we will have to explain many (more) times the difference between $var and @var)