Hi guys, I met a problem. When I tried this script below: //-------------------------------------------------------------------- sub print_instruction { my ($disk, $start, $end) = @_; print "Move disk #$disk from $start to $end.\n"; }
sub hanoi { my ($n, $start, $end, $extra, $m) = @_; if ($n == 1) { $m->(1, $start, $end); } else { hanoi($n-1, $start, $extra, $end); $m->($n, $start, $end); hanoi($n-1, $extra, $end, $start); } } &hanoi(3, 'A', 'C', 'B', \&print_instruction); //------------------------------------------------------------------------- I got a error : Undefined subroutine &main:: called at .... this is an example in <High Order Perl>, so it should not be wrong, I just don't known what is the problem. Plz help me. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/