[sr-dev] another syntax error
Juha Heinanen
jh at tutpro.com
Mon Jun 1 18:27:31 CEST 2009
Andrei Pelinescu-Onciul writes:
> If you mean defined ($fU), instead of defined $fU, I prefer defined $fU
> (is more perl-like) and defined ($fU) or defined($fU) works anyway.
great, i tested and also defined($fU) works!
> > this i don't understand. if i assign $something = "", then $something
> > is defined and test defined $something should return true.
>
> == is for comparisons not for assignment. If I compare an undefined
> value with "" in most languages is true.
empty string "" is a very well defined string value. it has nothing to
do with UNDEFINED. i could accept that it would be consider FALSE in a
test, but not UNDEFINED.
regarding "most languages", perhaps perl is such, but even in php, ""
value is a defined (set) value:
$var = '';
// This will evaluate to TRUE so the text will be printed.
if (isset($var)) {
echo "This var is set so I will print.";
}
how do we solve this problem? cast a vote or what?
-- juha
More information about the sr-dev
mailing list