Chris Wagner wrote:

> Forgive me, this should be like this:
> 
> open(FILE, "$file");
> binmode FILE;
> undef $/;
> $data = <FILE>;
> $count = $data =~ tr/\cJ/\cJ/;

I might be tempted to do something like:

        $data =~ s/[\r\n]+/\n/gs;

or even kill off the returns and newlines and make an array:

        my @lines = split /[\r\n]+/, $data;
        print OUTFILE "$_\n" foreach @lines;    # add the newline back

or if there are blank lines or \r's after the \n,
a little different split:

        my @lines = split /\r*\n\r*/, $data;

And get it all to a uniform \n newline or no newline at all.

Then if you write it out in text mode with the single \n, it will
become the proper DOSish \r\n again.

-- 
  ,-/-  __      _  _         $Bill Luebkert    Mailto:[EMAIL PROTECTED]
 (_/   /  )    // //       DBE Collectibles    Mailto:[EMAIL PROTECTED]
  / ) /--<  o // //      Castle of Medieval Myth & Magic http://www.todbe.com/
-/-' /___/_<_</_</_    http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Win32-Users mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to