Dear All,

Given the requirement that we are looking for unused columns, as soon
as we have seen all columns we can exit.  I would do:

my %look_for;

my @header = split /\t/, <DATA>;

for my $column (0 .. $#header - 1) {
    $look_for{$column} = undef;
}

while (<DATA>) {
    chomp;
    my @data = split /\t/;

    for my $column (keys %look_for) {
        if ($data[$column] ne "") {
            delete $look_for{$column};
        }
    }

    last if keys %look_for == 0;
}

for my $column (keys %look_for) {
    print "Field" . $header[$column] . "is empty\n";
}

[All above untested... E&OE]

I guess there is plenty of alternative ways to achieve this task.

Jonathan Paton

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to