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

Re: [MacPerl] unix CRs



On Mon, Apr 12, 1999 at 10:03:38PM -0500, Rick wrote:
} ok, i have another question if you guys would be so kind to help me
} out...  When i have MacPerl get a text document from the web for instance
} and save it, it is in unix format with unix CRs (\r) which the mac
} doesn't use.  how do i convert the document to mac format (\n).  i tried:
} 
} while(<FILE>) {
} 	$_ = s/\r/\n/g;

\r and \n are not constants.  You want to use

$_ =~ s/\012/\n/g;

Or more generally, to work on any ASCII text you might commonly get:

$_ =~ s/\015\012|\012|\015/\n/g;

(You can actually leave the $_ =~ out, since $_ is implied.)

Take a look at <http://pudge.net/macperl/perlport.html>.

} 	}
} 
} 
} but it doesn't work.  please help.
} 
} 
} 

-- 
Paul Schinder
schinder@pobox.com

===== Want to unsubscribe from this list?
===== Send mail with body "unsubscribe" to macperl-request@macperl.org