in reply to Chomp in perl

The following also seems to work on my computer:
#!/usr/bin/perl use warnings; use 5.16.2; $/ = "\n+"; while (<DATA>) { if ($_ =~ m/\+/) { s/\n\+//; } print; }

Replies are listed 'Best First'.
Re^2: Chomp in perl
by rnaeye (Friar) on Oct 05, 2014 at 16:25 UTC

    Added  __DATA__

    #!/usr/bin/perl use warnings; use 5.16.2; $/ = "\n+"; while (<DATA>) { if ($_ =~ m/\+/) { s/\n\+//; } print; } say ''; __DATA__ xabcd a1 +b1 +b2 +b3 +b4 +b5 abcd xcdef c1 +d1 +d2 +d3 +d4 +cdef