Re:Why I Use Perl: Reliability
by judofyr on Tuesday May 29, 2012 @04:24PM
(#4039612)
[ Parent
| on HN ]
Just in case anyone was wondering, in Perl 6:
sub factorial($n) {
my $output = 1;
for 1..$n -> $i {
$output *= $i;
}
$output;
}
or sub factorial2($n) {
[*] 1..$n;
}
Pretty anonymous function to add a constant: -> $x { $x + 7 }
Really short version: * + 7
Named: sub plus7($x) {
$x + 7;
}