Perl commands - exists versus defined http://stackoverflow.com/questions/6534573/whats-the-difference-between-exists-and-defined http://perldoc.perl.org/functions/defined.html http://perldoc.perl.org/functions/exists.html if (defined $hash{$key}) { } if (exists $hash{$key}) { } defined checks to see if value for key is not undef. so key may exists but it was assigned undef. exists checks to see if the key exists. q. defined $hash{key} tells you whether or not the value for the given key is defined (i.e. not undef). Use it to distinguish between undefined values and values that are false in a boolean context such as 0 and ''. exists $hash{key} tells you whether or not %hash contains the given key. Use it to distinguish between undefined values and non-existent ones. q.. #perl