Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^4: chomp question

by ramlight (Friar)
on Aug 08, 2012 at 13:59 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (3)
As of 2024-04-16 20:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found