From: LoneWolf <[EMAIL PROTECTED]>
> I have a 12 field 3000 line file (| delimited) and need to check the
> 7th entry of each line to see what it is, and based on that it needs
> to be written out to a file with a new entry in the 7th spot.  I could
> do it with a few entries to check, but the permutation is of 253
> different choices.

use a lookup hash:

        %map = (
                RR => 255,
                RX => 256,
                ...
        )

while (<>)       {
        chomp;
        @record = split /\|/, $_;
        $record[6] = $map{$record[6]} || 'unknown';
        print join('|', @record),"\n";
}

If you have the mapping between the codes and numbers in the database 
you will probably want to populate the hash from the database.

Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to