in reply to Getting same output doing pattern matching

On a side note, the error checks you do on the CONFIG filehandle as you read it in are already done by perl automagically.

#The line: while ( defined ($_ = <CONFIG>) ) #can be simplified to: while(<CONFIG>)

When you use the <> in the conditional of a while loop, perl automatically sets the $_ variable to be the input record it read from the file. It also checks that it is defined() for you so you don't have to.

Just a little sweet syntactic sugar for you.