P
peter pilsl
I look for an shorter version of for:
if (defined $x and $x ne '') { ...}
One of my most frequent programm-bugs is that I often include statements
like:
if ($x) { ...}
which skips the block, if $x is undefined, empty or has the value 0.
And the latter is my problem: I would like to have a
as-simple-as-possible-statment that checks if $x is undefined or '' but
returns true if the value is 0, cause 0 is a perfect normal value in
most of my applications. Is there kind of a "numeric-aware" not-operator?
thnx,
peter
if (defined $x and $x ne '') { ...}
One of my most frequent programm-bugs is that I often include statements
like:
if ($x) { ...}
which skips the block, if $x is undefined, empty or has the value 0.
And the latter is my problem: I would like to have a
as-simple-as-possible-statment that checks if $x is undefined or '' but
returns true if the value is 0, cause 0 is a perfect normal value in
most of my applications. Is there kind of a "numeric-aware" not-operator?
thnx,
peter