On Wed, 8 Mar 2000 16:43:31 -0500, Eric Rainey wrote: >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 Yup. >b. A way to convert these newlines to regular newlines in BBEdit so >that the text will wrap when it encounters one. If it's plain Ascii, no accented characters, you can do it in BB-Edit alone. You have the option to open files in BB-Edit as PC or Unix files. Just check the "LF translation" option in the "open" dialog box. Pull down the file option menu (second button) and set to "Macintosh" line breaks, or do "save as...", and click the "options..." button, and check "Macintosh line breaks". Or, using MacPerl, you can convert any line break into a Mac line break, as: #perl -i.bak undef $/; #whole file at once while(<>) { s/\012|\015\012|\015/\n/g; print; } The reason for reading in a whole file at a time is not to accidently break up a CR+LF pair. >c. A way to print each item of a list on a separate line. > >(I realize this last appears to be unrelated). Simply do: $, = "\n"; # between items and optionally: $\ = "\n"; # print with newline at end and now print @ary; and every item will be printed followed by a newline. Alternatives: $" = "\n"; print "@ary\n"; or foreach (@ary) { print "$_\n"; } -- Bart. # ===== Want to unsubscribe from this list? # ===== Send mail with body "unsubscribe" to macperl-request@macperl.org