in reply to Guess That Number

I think you could have a look at this solution. It is older on the web than your node: http://perltraining.com.au/tips/2008-03-12.html