Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: replacing blank lines

by Tuna (Friar)
on Mar 06, 2001 at 01:54 UTC ( [id://62355]=note: print w/replies, xml ) Need Help??


in reply to replacing blank lines

one way is:
#!/usr/bin/perl -w use strict; my $line; my $element; my @list; while ($line = <DATA>){ chomp $line; unless ($line =~ /^\s*$/) { push(@list, $line); } } foreach $element(@list){ print "my remaining lines are: $element\n"; } __DATA__ 1 1 Foo Bar Baz 2 2 Foo Bar Baz __END__

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (9)
As of 2024-04-23 10:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found