Wc -Sx- Jones wrote: > > Bryan Harris wrote: > > > > I did this because I want to make sure I end with a "\n", but I don't want > > an extra one if one is already there. I guess I could've also done a: > > > > $newtxt =~ s/([^\n])$/$1\n/; > > This is clearer: > > $newtext = "Hello\n\n\n"; > $newtext =~ s/\n+/\n/; > print $newtext;
Yes but that won't put a newline at the end of a string that doesn't already have one which was what the OP wanted. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>