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

Re: [MacPerl] Recognizing Unix Line Breaks



At 0.04 97/5/5, Jacob Miller wrote:
>I'm quite an amatuer at perl.. so here's a (hopefully) simple question for
>you all.
>
>How can I get mac perl to regonize Unix line breaks as such..  it seems to
>read them in as an unknown character.  I do most of my text editing with
>BBEdit and its defaulted to Unix (as it saves a lot of frustration when
>uploading scripts and config files) .. but I have to change back over to
>Macintosh to import a file into Mac Perl.

You have to have linebreaks in Macintosh format.  I do the same thing as
you, and have BBEdit default to Unix.  But I have to change them to Mac to
use them with MacPerl.  There are things you can do to make it easier.  One
is to drop your files on a little droplet (code below).  But I just open it
in BBEdit and do it manually, unless I have a ton of files to go through.

#       This script fixes problem caused by UNIX text files impported to the
#       Mac in binary mode, so lines are terminated with LF instead of CR.
#       Drop your files on the following droplet:
#!perl
$/ = "\012";
$^I = ".orig";
while (<>) {
    s/\012/\015/g;
    print;
}
__END__

Hope this helps,

--
Chris Nandor                 pudge@pobox.com                 http://pudge.net/
%PGPKey=('B76E72AD',[1024,'08 24 09 0B CE 73 CA 10  1F F7 7F 13 81 80 B6 B6'])
#=============================================================================
I went to the hardware store and bought some used paint.  It was in the shape
of a house.  I also bought some batteries, but they weren't included.  So I
had to buy them again.
                --Steven Wright
#=============================================================================



***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch