use strict; use warnings; my $i = 0; sub hanoi { my ($mai , $x, $y, $z) =@_; if ($mai > 0){ hanoi($mai-1 , $x , $z , $y ); print ++$i; print "move", $mai ,"from", $x ,"to", $z ,"\n"; hanoi($mai-1 , $y , $x , $z ); } } hanoi(3, "A", "B", "C");