Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^4: chomp question

by ramlight (Friar)
on Aug 08, 2012 at 13:59 UTC ( #986284=note: print w/replies, xml ) Need Help??


in reply to Re^3: chomp question
in thread chomp question

Perhaps this will do what you want to do?
use strict; use warnings; while (my $line = <DATA>) { if ($line =~ /CLI/) { chomp $line; while (my $line2 = <DATA>) { next unless $line2 =~ /\S/; # ignore blank lines $line .= " $line2"; last; } } print $line; } __END__ MVC DOWO(8),WCPA CLI WCPA+2,C'.' BNE UPCC22
which prints
bash-3.2$ perl suno.pl MVC DOWO(8),WCPA CLI WCPA+2,C'.' BNE UPCC22 bash-3.2$

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (7)
As of 2022-08-08 07:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?