Gunnar Hjalmarsson wrote:
You may want to remove the field names from the database, to avoid the need to test for them at each iteration.

Optionally you can extract the field names from the first line of the database rather than hardcode them:


    sub tabinfo_hash {
        my @elems = ( split ' ', <DATA> )[1..6];
        my %tih;
        while (<DATA>) {
            ( my $table, my @vals) = split or next;
            @{ $tih{$table} }{ @elems } = @vals;
            last if $. > 10;
        }
        \%tih;
    }

TMTOWTDI :)

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

--
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