http://www.perlmonks.org?node_id=263640

I know there have been discussions about this before (did a search for hanoi) and there is a shorter golf solution out there somewhere, but here's my effort anyway - it is parameterised so you can do hanoi.pl <number of rings>

enjoy!

sub d{print"\ec";select$q,$q,$q,0.3;for$p(0..2){printf"\e[%d;%dH%s".$/ +x$ d,$d-$_+2,2*$d*(1+$p)-($$p[$_]?(length$$p[$_])/2:1),$$p[$_]||"|"for 0. +.$ d-1}}push@0,"-"x(1-2*$_)for-($d=shift||3)+1..0;sub h{my($n,$s,$d,$i)=@ +_; if($n>0){h($n-1,$s,$i,$d);push@$d,pop@$s;d;h($n-1,$i,$d,$s)}}h($d,0,2, +1)

alex
Edit: Oh sorry guys i so should have said it requires VT100
Edit again: I've knocked up this non VT100 version for those that can't see the previous one.
HTH