jeudi 29 janvier 2015

Perl hash data check in IF condition not working

I'm new to perl and I'm working on perl code which use hashes. I wonder why I can't use hash data in a IF condition. For example,


Value of $post_val{'module'} is extension.



print "Module value: $post_val{'module'}\n";

if (chomp($post_val{'module'}) eq "extension") {
print "correct...\n";
} else {
print "wrong...\n";
}


I get following output,



Module value: extension


wrong...



What is going wrong here?


Aucun commentaire:

Enregistrer un commentaire