in reply to Re: perl if statement
in thread perl if statement

which is a one line fix in the templated version, and a fix in two different places in the code in the OP's version. ;-)

Templates for the win!

Premature optimization is the root of all job security