RosettaCodeData/Task/Anonymous-recursion/Perl/anonymous-recursion-3.pl

7 lines
164 B
Perl
Raw Permalink Normal View History

2013-04-10 14:58:50 -07:00
sub fibo {
my $n = shift;
$n < 0 and die 'Negative argument';
no strict 'refs';
$n < 3 ? 1 : (caller(0))[3]->($n - 1) + (caller(0))[3]->($n - 2);
}