in reply to Pattern Match Issue
Your code doesn't compile as presented; I assume that you mean to have two } at the end of the while loop, and that the contents after > is what's in $IN2? In this case, the problem is that the IRS $/ is set to be a newline, so the string is read as 3 separate lines, rather than 1 big one as you'd hope. You could ‘slurp’ by using local $/, if that's the effect that you want.