in reply to help on searching a file

Apart from using <CODE> tags to format your code, which will get you better answers, you havent posted your subroutine in its entirety.

Therefore its difficult to narrow down your problem...

What exactly is your error? what doesnt appear where you want it to?