Home |  MySQL Buzz |  FAQ |  Feeds |  Submit your blog feed |  Feedback |  Archive |  Aggregate feed RSS 2.0 English Deutsch Español Français Italiano 日本語 Русский
Moving From Perl 5 to Perl 6 – What's New, Tutorial Style
+0 Vote Up -0 Vote Down

Newsflash: Perl 6 is not dead (in case you thought it was)!

I stumbled upon this most excellent series of posts by Moritz Lenz of perlgeek.de that describe the differences between Perl 5 and the upcoming Perl 6 (thanks to Andy Lester for the link). The posts are done in the form of tutorials, which helps comprehension. Simply awesome, Moritz.

It seems like Perl 6 is going to be a lot more object oriented, but such orientation is optional and not forced upon programmers, like in, say, Java. It warms my heart that I will be able to do this (you did see the new "say" function in Perl 5.10, right?):

1
2
3
my Num $x = 3.4;
say $x.WHAT; # Num
say "foo".WHAT; # Str

My favorite Perl 6 change so far is this:

1
2
3
4
5
6
7
8
9
# named arguments
 
sub doit(:$when, :$what) {
  say "doing $what at $when";
}
 
doit(what => 'stuff', when => 'once');  # 'doing stuff at once'
 
doit(:when, :what('more stuff')); # 'doing more stuff at noon'

I've first seen this technique in Ruby (apparently Python has it too), and have been using an anonymous hash in order to emulate named arguments in Perl 5. Perl 6 does it in a much cleaner way.

I wonder if there are any Perl 6 changes specifically affecting file/disk access, MySQL interaction, and execution speed.

What is your favorite new feature? Comments welcome.

Edit: Whoa, string concatenation is now ~, the dot . is used for method calls. That's kind of upsetting, I'm so used to '.'.

Edit #2: Holy crap, regex changed so much, it just warped my head onto itself and now I have a black hole in place of my face, thanks a lot. Regexes are also now called "Rules". More here

Similar Posts:

Votes:

You must be logged in with a MySQL account to vote on Planet MySQL entries. More information on PlanetMySQL voting.

Planet MySQL © 1995-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc.,
2010, Oracle Corporation and/or its affiliates.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.