[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] Reading a Unix vs a DOS text file



We have this log monitoring script that mostly works.  Sometimes.  Once you get it configured and throw some holy penguin pee on it.  So a few months ago I took it upon myself to rework it into something more robust and, well, better.

The script itself is one of the worst programs I have ever seen (sadly, not *the* worst).  The person who wrote it only thought they knew something about Perl but really didn't.  So I spent some off-time working on this off and on (mostly off) until recently I told people that it's working better now -- bigger, faster, and stronger.

Regardless of the fact that all our processes run on Linux, this one particular application decided that it wants to save it's log files in DOS format.  Perl is thinking that, hey, it's in a Unix-like environment and doesn't quite read that file right.

So . . . it there a way I could get Perl to detect a file that uses CRLF as it's line terminator?  That way, I could use binmode on that file, and use ASCII on the rest.  Or does someone have a better suggestion?

--
Mike Hostetler
http://mike.hostetlerhome.com/