I am trying to remove single newlines but not double newlines.
for instance say I have the following:
Name:\nMy Name\n\nAddress:\n123 Anywhere St\n\nAbout Me:\nSome text
that\nhas some newlines that\nI want to be rid of\n\nThe End\n
I want to get rid of all of the newlines between Me:\n and the next
occurrence of \n\n. and replace them with spaces so it says:
Name:\nMy Name\n\nAddress:\n123 Anywhere St\n\nAbout Me:\nSome text
that has some newlines that I want to be rid of\n\nThe End\n
I'm completely at a loss on how to pull this off...
sub fixer($){
my $data = $_[0];
$data =~ s/\\n{1}/ /g; #this is too greedy
print $data;
}
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/