Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: Reading "slices" out of a file at known start markers

by repellent (Priest)
on Oct 03, 2008 at 08:47 UTC ( [id://715160]=note: print w/replies, xml ) Need Help??


in reply to Re: Reading "slices" out of a file at known start markers
in thread Reading "slices" out of a file at known start markers

We can avoid pushing into an array @file if the goal is just to print it out:
while(<DATA>) { chomp; # find out if there's a line continuation # and remove the trailing backslash my $cont = s/\\\s*$//; # print without newline, no matter what print; # decide whether to end print with newline print "\n" unless $cont; }

Update: Actually, a simple substitution would suffice:
while (<DATA>) { s/\\\s*\n//; print; }

Log In?
Username:
Password:

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

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

    No recent polls found