Probably unrelated to your problem, but your outer while
loop will be infinite if your @thisfile array has any contents. It would be better to use a for loop instead:
Actually, this is related. Anonymous' regex is trying to match against $_, but while loops (and everything else in this code) don't set $_, so it's undefined. If you change the outer while to a for then you have something that sets $_.
Update: Complete gibberish fixed. Now it says what I meant to say
--DrWhy
"If God had meant for us to think for ourselves he would have given us brains. Oh, wait..."