in reply to Finding Empty Columns
How can I determine if the entire column consists of zero data?Three things:
my @rows = map { chomp; [ split /;/ ] } <>; # now you have an array of arrays (rows of columns) my $column = 1; # which column to check for 0 in? if ( grep { $_->[$column] ne "0" } @rows ) { print "Column $column does NOT consist of all 0's.\n"; } # you could extract the contents of just that column, if you need to +: my @column1 = map { $_->[1] } @rows;
jdporter
The 6th Rule of Perl Club is -- There is no Rule #6.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Finding Empty Columns
by Anonymous Monk on Feb 14, 2003 at 20:48 UTC | |
by jdporter (Paladin) on Feb 14, 2003 at 21:17 UTC |