my $fib_die_msg = 'fib() takes one positive integer as argument, aborted'; sub fib { my($nth = shift) =~ m{^\d+$} or die $fib_die_msg; @_ and die $fib_die_msg; return $nth if $nth <= 1; return fib( $nth - 1 ) + fib( $nth - 2 ); }