Alex Muntada
Perl Mongers de Barcelona
1987 - Perl 1.0 (anunci a comp.sources.misc)
1988 - Perl 2 (millora del motor d'expressions regulars)
1989 - Perl 3 (suport per dades binàries)
1991 - Perl 4 (primera edició de Programming Perl)
1994 - Perl 5 (se'n reescriuen moltes parts)
1995 - CPAN (Comprehensive Perl Archive Network)
2000 - crida per a comentaris (RFC) sobre Perl 6
2001 - resums dels 361 comentaris rebuts (apocalipsis)
2004 - resums dels apocalipsis (sinopsis)
2005 - Pugs (intèrpret de Perl 6 en Haskell)
2009 - Parrot 1.0 (màquina virtual de registres)
2010 - Rakudo * (distribució per a desenvolupadors)
»ö«
...oi que és simpàtica? :)
Tal com es faria en Perl 5
say "hello, world"; say 42;
En Perl 6 també però ara, a més tot és un objecte
"hello, world".say; 42.say;
my $string = "hello, world"; my $number = 42; my @array = 1, 2, 3; say @array[1]; # 2 my %hash = key => 'value'; say %hash{'key'}; # value
my Int $i = 42; $i = "hello, world"; # Type check failed for assignment my Str $s = "hello, world"; $s = 42; # Type check failed for assignment my Str $s = "hello, world"; $s = 42.Str; $s.perl.say; # "42"
say ~[42.WHAT, 'string'.WHAT, (3/7).WHAT, /foo.*/.WHAT]; # Int() Str() Rat() Regex() 'string'.^methods.sort[40..45]; # atanh bless bytes can capitalize ceiling "the big brown fox".split(' ').grep(/^b/).join(' and '); # big and brown my $a = { foo => [1,2,3] }; $a<foo>.push(4);
sub func (Str $what, Int $times = 1) { say $what x $times } func "hello", 3; # hellohellohello func "hello"; # hello func; # Not enough positional parameters passed; # got 0 but expected between 1 and 2
say 'ok' if 5 == any(3,5,7); say 'ok' if 5 == 3|5|7; say 'ok' if 5 == none(4,6,8); my Junction $x = 3|5; say 'ok' if $x == 5; my @scores = 32, 41, 73, 99, 52; say 'ok' if all(@scores) > 30;
my $even = (2, 4 ... *); $even[^10].perl.say; # (2, 4, 6, 8, 10, 12, 14, 16, 18, 20) my $fib = (1, 1, *+* ... *); $fib[^5].perl.say; # (1, 1, 2, 3, 5)
class Point { has Int $.x is rw; has Int $.y is rw; method clear { $.x = 0; $.y = 0; } }
class Point3D is Point { has Int $.z is rw; method clear { nextsame; $.z = 0; } }
grammar URI { token TOP { <schema> '://' [<hostname> | <ip> ] [ ':' <port>]? <path>? } token byte { (\d**{1..3}) <?{ $0 < 256 }> } token ip { <byte> [\. <byte> ] ** 3 } token schema { \w+ } token hostname { (\w+) ( \. \w+ )* } token port { \d+ } token path { '/' <[ a..z A..Z 0..9 _\-.!~*'():@&=+$,/ ]>+ } } my $match = URI.parse('http://perl6.org/documentation/'); say $match<hostname>; # perl6.org say $match<path>; # documentation