Patrick Michaud announced the date of Rakudo Perl, AKA Perl 6, on YAPC::EU 2009 in Lisbon for Spring 2010 … now it is a reality.

You can download Rakudo Star (or Rakudo *) from rakudo.org

This is my first script in Perl 6:

use v6;

my $file = open 'my_app_list';
my @names = $file.get.split(' ');
my %person;

for $file.lines -> $line{
   my ($surname, $name) = $line.split(', ');
   %person{$name} = $surname;
}

for %person.kv -> $n, $a {
   say "Name: $n\nSurname: $a\n";
}

Look the following lines:

my @names = $file.get.split(‘ ‘);  GET is a method on the file handle stored in $file, and read an returns one line  from the file, then call the SPLIT (another method).

Another curiosity: How can I print a variable value?

$surname.say; # in Perl 6 print the value... Gorgeous!!! :p

print $surname; # in Perl 5

There is still much to learn!!! :)

This script get a “my_app_list”  a text file like:

Skywalker, Luke

Wan Kenobi, Obi

Vader, Darth

And print a output like:

Name: Luke

Surname: Skywalker

This are my processing time:

real    0m2.491s
user    0m1.628s
sys    0m0.132s

Yes, a little slow, but a reality. And now we can start to write modules for Perl 6.

Good Perl!

  1. gorgeous
About these ads