Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Re: replacing blank lines

by KM (Priest)
on Mar 06, 2001 at 05:36 UTC ( [id://62408]=note: print w/replies, xml ) Need Help??


in reply to Re: replacing blank lines
in thread replacing blank lines

# Create a file array of lines while ($line = <FILE>){ push (@array, $line); }

ew.... just do:

my @array = <FILE>;

# Then control the output foreach $index (@array){ # if the line is completely blank dont print it. if ($index !~ /^\s*\n\s*$/) { print "$index"; } }

ewwwww... use something more like:

for (@array) { print unless /^(\n|\s+)$/; }

Even better, do it from the command line (see another node in this same thread)

Cheers,
KM

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2024-04-20 04:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found