On 12-06-06 10:27 AM, Matt wrote:
Looking at some old code I wrote.
my @listing;
open(IN, list.txt) or die $!;
while (<IN>) {
chomp;
next if /^\s*$/;
# skip lines beginning with whitespace
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.
--
Just my 0.00000002 million dollars worth,
Shawn
Programming is as much about organization and communication
as it is about coding.
_Perl links_
official site : http://www.perl.org/
beginners' help : http://learn.perl.org/faq/beginners.html
advance help : http://perlmonks.org/
documentation : http://perldoc.perl.org/
news : http://perlsphere.net/
repository : http://www.cpan.org/
blog : http://blogs.perl.org/
regional groups : http://www.pm.org/
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/