Quoth Steve Anderson <>:
> I'd like to use perl to remove all single carriage returns, but leave all
> double carriage returns intact in a text file.
>
> For example, the following:
>
> foo bar baz
> baz bar foo baz
> baz
>
> baz foo bar
> baz
>
> should become:
>
> foo bar baz baz bar foo baz baz
>
> baz foo bar baz
>
> It sounds simple, but I haven't been able to figure out how to do this.
> Can anyone give me a hand?
#!/usr/bin/perl
$/ = $\ = "\n\n";
while (<>) {
chomp;
s/\n//g;
print;
}
__END__
Ben
--
All persons, living or dead, are entirely coincidental.
Kurt Vonnegut