in reply to Re^2: A perverse use of grep
in thread A perverse use of grep

I would also recommend localizing $_, because while doesn't do it automatically:
sub whatever { local $_; while(<$in>) { # do stuff } }

Even if the loop is not in a sub, localizing $_ can prevent nasty bugs if you decided to wrap the loop in a sub later.