[Israel.pm] defined function

Chanan Berler chananb at centerity.com
Sun Jan 18 01:21:27 PST 2009

Hi All,

Sure, I will ask again if am asking too many questions…nor if the questions are weird ☺
None the less, I will try ask them...

I was told defined is a function, returns 0 or nonzero values
So here is my question

"do something" unless $myscalar;               -> this is OK
"do something" unless $myhash{mykey};          -> seems not to work for me


"do something" unless defined($myscalar);      -> this is OK
"do something" unless defined($myhash{mykey}); -> now this works for me

What best should I do? Although the answer is in the script body (means using defined)
PS: using now strict / warnings :-) never showed any warnings / errors

Thanks again

More information about the Perl mailing list