Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^9: Parsing problem

by kcott (Abbot)
on Nov 16, 2012 at 09:02 UTC ( #1004157=note: print w/ replies, xml ) Need Help??


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


Comment on Re^9: Parsing problem
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1004157]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (10)
As of 2015-07-06 07:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (70 votes), past polls