As perlplexer points out $modifiedFiles is a HASH ref not an ARRAY ref thus the code you post is not the cause of your troubles. You wish to check if a HASH KEY exists, and here is how you do it (you need the defined otherwise the key can exist but have a value of '' or 0 which will be false). unless(blah) is the same as if(! blah)
my $hash_ref = {}; unless ( defined $hash_ref->{'some_key'}) { print "some_key is not defined\n"; } my $other_hash_ref = { 'some_key' => 0 }; if ( ! defined $other_hash_ref->{'some_key'}) { print "some_key is not defined\n"; } else { print "some_key is defined\n"; }
cheers
tachyon
s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print
In reply to Re: Simple array checking?
by tachyon
in thread Simple array checking?
by costas
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |