http://www.perlmonks.org?node_id=622293


in reply to grep and find file weirdness

Yes, the is_dos_format() is smashing $_ in your grep block. The easy fix is to either local()ize $_ in the function or use a different variable in your while loop:
sub is_dos_format { local $_; ... } # or sub is_dos_format { ... while (my $line = <RJA>) { ... }

Jeff japhy Pinyan, P.L., P.M., P.O.D, X.S.: Perl, regex, and perl hacker
How can we ever be the sold short or the cheated, we who for every service have long ago been overpaid? ~~ Meister Eckhart