Sorry - to check that the headers exist change the first part of the if()
statement to:
if ($line++ == 0)
{
my $i;
$column{$_} = $i++ foreach @field;
foreach (@required)
{
die "Column $_ doesn't exist"
unless exists $column{$_};
}
}
Rob
"News.Support.Veritas.Com" <[EMAIL PROTECTED]> wrote in
message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
> Before working with lines in a csv file I would like to check the headers
> from the file for accuracy i.e. do the headers I expect exist, and are
they
> in the right order.
>
> Alternatively, and even better, I would like to check all headers I
require
> exist, then for each parsed line extract only extract fileds that match
the
> respective header values I want. Can anyone guide me in the best direction
> to achieve either option.
>
> Thanks
>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]