#!/usr/bin/perl -w
use strict;
use v5.10;
use subs 'hanoi';
#sub hanoi;
sub hanoi {
return unless (my $disk = shift)--;
my ($from, $empty, $to) = @_;
hanoi $disk, $from, $to, $empty;
say "move disk $disk from the $from stack to the $to stack";
hanoi $disk, $empty, $from, $to;
}
hanoi shift, "left", "middle", "right";