in reply to Reg Ex exercise
You will want to use chomp, not chop. Then you can put all your codes within a while loop more constructively.