Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Chomp in perl

by rnaeye (Friar)
on Oct 05, 2014 at 16:23 UTC ( [id://1102875]=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1102875]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (5)
As of 2024-03-29 00:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found