On Wed, 3 Oct 2001 12:26:52 +0200, Peder Axensten wrote:

>I have a huge text file with Unix line endings that I want to process 
>line by line with something like:
>while (<>) {...}
>
>As MacPerl doesn't recognize Unix line endings it think the file is 
>just one big line...
>Any suggestions?

Set $/ to "\012". Then, MacPerl will happily read your file line by
line, and chomp() will get rid of the LF. You'll need to do that, or
something similar, because /$/ will not match just before the LF.

You can set $\ to "\n" or to "\012" to add a Mac line-end (CR) or a Unix
line-end (LF) for each print() you do.

-- 
        Bart.

Reply via email to