in reply to hash checking

Firstly you should check if the key 'three' does exist in the hash or not. Secondly you should convert the value to lowercase before comparison (as pointed out by other monks). And then you should have a more generic comparison that allows for spaces in the value (just to be fool proof :-). I would do something like:

warn 'question three does not exist' if ! exists $questions{'three'}; if (lc $question{'three'} =~ /^\s*?false\s*?$/) { $right++; } else { $wrong++; }


This way if your hash was not properly constructed you would catch the error immediately.