http://www.perlmonks.org?node_id=1004157


in reply to Re^8: Parsing problem
in thread Parsing problem

Your problem here is that the number after 'FT        /colour=' (in this case "4"), is used as a key for %cod but you've only assigned @cod{qw{1 2 3}}. Using the following line solved the problem for me (you'll probably want a different value):

my %cod = ( 1 => "red", 2 => "non", 3 => "green", 4 => 'value for key +4' );

Alternatively, you can check $cod{$1} before using it:

if ( exists $cod{$1} and $cod{$1} eq "non" ) { printf ...

-- Ken