Help for this page

Select Code to Download


  1. or download this
    sub hanoi {
        my ($n, $a, $b, $c) = @_;
    ...
       The final 'return' allows for a slight
       tail-call optimization
    
  2. or download this
    ##
    # hanoi n a b c
    ...
    $ hanoi(8, "A", "B", "C")
    => 2^8 - 1 moves