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

Re:[MacPerl] keeping my newlines straight



At 16:43 -0500 3/8/00, Eric Rainey was kind enough to write:


]Hi:
]
]I've noticed that occasionally I GET (or otherwise obtain) a file 
which apparently is using Unix newline characters?  They show up in 
BBEdit as a little  hollow block (or a red, upside down question mark 
if I turn on 'show invisibles').  If I copy one to the find field in 
BBEdit, it gets transformed into a '\n'.  MacPerl will match it as 
'\012', which is why I figure it's a unix newline.  BBEdit won't 
match anything with '\012' (although it will change it to '\\012' if 
I'm not using grep).
]
]I'm looking for:
]
]a.  Confirmation/explanation

Confirmed.


]b.  A way to convert these newlines to regular newlines in BBEdit so 
that the text will wrap when it encounters one.

This is a 'LF conversion' situation. The 'Filing' preference has a 
checkbox to convert linefeeds when opening files by default. If you 
want to just do this for one file at a time, you can check the 'LF 
conversion' checkbox in the Open dialog.


]c.  A way to print each item of a list on a separate line.

You mean a program to print? Or a way to create formatted output from 
a list, which could then be printed by using File...Print.

I can't help you with the former, but the latter can be hacked with:

#-----

foreach $item (@list) {
	$resultstring .= "\n$item";
};

print($resultstring);

#-----

-Graeme.
-- 
-----------------------------------------------------------------
Graeme Kennedy                   P 604.816.6061
SEER Communications              F 604.261.5339
PO Box 71027                     E mailto:graeme@seercom.com
Vancouver, BC V6N 4J9            W http://www.seercom.com

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