Friday, May 25, 2007  Perl 6: Round 2  Pugs revision: r16525  In
the last article, I discussed some of the basic tenets of Perl
6. Continuing from here, we will go onto using subroutines and
other dilly dallying.  Subroutines have taken a few good changes
in Perl 6. There are also things that have been left alone, as
we shall see. Let's go ahead and start:  [altair@stormwind
diveintoperl6]$ pugs  pugs> sub abcd { ....> True; ....> } pugs>
if (abcd() == True) { say 'yes!'; }  Too trivial, but an example
nonetheless (well, it at least shows that the last expression
evaluated in a sub is the return by default; but I hope you
caught that.)  Before going on, I'll take this time to point out
a couple of different ways you can define subroutines. The first
and most apparent, is a named subroutine:  pugs> sub cool
($a,$b,$c) { ....> $a ~ $b ~ $c; ....> } pugs> (cool
"ab","cd","ef").say;  You may also specify the return type in
the parameter (remember the type system?) The above could also
have been started with:  sub