Thanks to everyone for the help, I manage to get it working, not at all optimised like some of the code here, but it was more to get a hang of control structures and a few other things in ruby. -- Posted via http://www.ruby-forum.com/.