Looking at some old code I wrote.
my @listing;
open(IN, list.txt) or die $!;
while (<IN>) {
chomp;
next if /^\s*$/;
next if /^#/;
push(@listing, $_);
}
close IN;
I want to trim any new lines off end of data. chomp does that. I
want to skip any lines that begin with # and next if /^#/ does that.
I also want to skip any lines that begin with whitespace. How would I
do that? I thought /^\s*$/ did but it is not.
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/