"(This is mostly just a skeleton with a few key URLs; feel free to flesh it out, improve the formatting etc.)"Oh well, still a good starting place, I'll dig a little more
pugs> say "hello erf" hello erf bool::true pugs>It may be simple, but its working perl 6 code.
my $square = -> $x { $x * $x }; # use "->" to introduce args my @squares = map $square, 1 .. 10;I think, from reading the article futher that this means "taking in" so the above example says $square is a function, taking in
$x
, and the next line calls the square function using map, so
that @squares
is full of the following sequence 1,4,9 ... 100
@*todo
though...
+-------%< greeting.pl %<-----------------+ # Script to display hello worldVery Basic, but a start!
"Hello World".say(); +-------%<-------------%<-----------------+
C:\perl6>pugs-win32\pugs.exe perl6code\greeting.pl Hello World C:\perl6>
+-------%< squares.pl %<-----------------+ # Squares example
my $square = -> $x { $x * $x }; # use "->" to introduce args my @squares = map $square, 1 .. 10;
@squares.join("\n").say(); +-------%<-------------%<-----------------+
C:\perl6>pugs-win32\pugs.exe perl6code\squares.pl 1 4 9 16 25 36 49 64 81 100 C:\Documents and Settings\Administrator\My Documents\perl\perl6>
It strikes me that you need to know perl5 to get into perl6 at the moment
What makes you say that? Anyone with knowledge of Smalltalk or Ruby or Lisp or the like (basically anything that has lists and closures) should be immediately familiar. In fact, they’ll have an easier time getting into the Perl 6 version, where you can specify a parameter, than the Perl 5 version, where you have to monkey with this bizarre $_ thing.
Conext of remark screwy
lilstevey on 2006-09-08T14:39:56
I should probably have been more carefull explaining the context of the remark - I was refering to what I perceived as the current state of documentation and articles about perl 6, rather than arrow operator or perl 6 in general.