[Pdx-pm] UNIX NL verses MS(DOS) CRLF

Michael Rasmussen mikeraz at patch.com
Tue Aug 31 12:52:07 CDT 2004


On Tue, Aug 31, 2004 at 09:25:17AM -0700, Roderick A. Anderson wrote:
> I am processing files on a Windows system from a Linux system that has the
> share as a SMB mount.  I'm using Marc Overmeer's Mailbox collection to
> process spam folders (mailboxen) and any time the process (re)writes the
> file I end up with NLs instead of CRLFs.  

If I'm wrong, someone will step in and correct me.

The EOL for writing is controlled by the Output Record Seperator, AKA $\
this is different than the Input Record Sep. of $/.
  
you can explicitly set the beast and it can be different than $/.  
See `man perlvar` for more information.
  
This means you can have this code snip:
  
  
  $\ = "\r\n";
  
  open IFILE, "<$unixEOLfile";
  open OFILE, ">$dosEOLfile";
  
  while (<IFILE>) {
          chomp;
          print OFILE;
  }
  
  close IFILE;
  close OFILE;
  



-- 
    Michael Rasmussen, Portland Oregon  
  Be appropriate && Follow your curiosity
 http://meme.patch.com/memes/BicycleRiding
   Get Fixed:  http://www.dampfixie.org
  The fortune cookie says:
You must know that a man can have only one invulnerable loyalty, loyalty
to his own concept of the obligations of manhood.  All other loyalties
are merely deputies of that one.
		-- Nero Wolfe



More information about the Pdx-pm-list mailing list