in reply to Re^2: Odd (to me) case of wrongly guessing context
in thread Odd (to me) case of wrongly guessing context
DB<106> (my ($ar) = () ) || print "bla" bla DB<108> (my ($ar) = (1) ) || print "bla" => 1 DB<109> (my ($ar) = (0) ) || print "bla" => 1 DB<110> (my ($ar) = (undef) )|| print "bla" => 1 DB<111> (my ($ar) = (undef,undef) )|| print "bla" => 2
list-assignment in scalar context counts and the count is always defined. (see also goatse-operator for comparison.)
DB<119> scalar ( my ($ar) = () ) => 0
so only empty-list is 0 and false.
But I'm not sure if I'm in favour of such constructs...
Cheers Rolf
( addicted to the Perl Programming Language)
|
|---|