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

Mike Hostetler hostetlerm at gmail.com
Thu Mar 26 08:49:46 PDT 2009


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/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/omaha-pm/attachments/20090326/6dcccc86/attachment.html>


More information about the Omaha-pm mailing list