Steve Sotis wrote:
> I have a Perl script that displays html that allows people to upload 
> line-delimited text files, which the Perl script then reads with a
> 
> @records = <FH>;
> 
> It's been working for years, until recently a Mac user tried it.
> 
> Apparently the Mac only puts \r (0x0d) at the end of each line, whereas 
> other platforms seem to put \r\n(0x0d, 0x0a), which seems to defeat the 
> "@records = <FH>" logic.
> 
> Anyone have a workaround? Not only for replacing the \r's with \r\n's, 
> but also to detect whether it's required.

Try one of these:

my $file;
{ local $/ = undef; $file = <FD> }
my @records = split /\r/, $file;


my @records;
{ local $/ = "\r"; @records = <FD> }


-- 
   ,-/-  __      _  _         $Bill Luebkert   ICQ=162126130
  (_/   /  )    // //       DBE Collectibles   Mailto:[EMAIL PROTECTED]
   / ) /--<  o // //      http://dbecoll.tripod.com/ (Free site for Perl)
-/-' /___/_<_</_</_     Castle of Medieval Myth & Magic http://www.todbe.com/


_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to