in reply to Trouble with flow control
If you'd had warnings on, perl would have told you what you were doing wrong.
Always:
use strict; use warnings; [download]