Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re: If statement problem with hash values

by Elijah (Hermit)
on Jun 15, 2005 at 17:42 UTC ( #466988=note: print w/replies, xml ) Need Help??

in reply to If statement problem with hash values

Couple of things:
An array reference starts at 0 and your reference object while, it is the third object in the list is going to be at location 2 not 3 in the array. Second you have a redundant check there and the "defined's" can be removed. The entire conditional statement can be simplified to this:
if ($elements[2]) { print ("Parsing Error: Line $z\n"); if ($refList{$elements[2]}) { print ("Already Present in file\n"); } else { print "No match in reference file\n"; print (NEWALIGN $alignment->{$z}."\n"); print (NEWACC $elements[2]."\n"); } }

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2023-02-06 09:14 GMT
Find Nodes?
    Voting Booth?
    I prefer not to run the latest version of Perl because:

    Results (33 votes). Check out past polls.