[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] not defined $j || scalar @$j == 0



Doh. "use strict" pukes even when a short-circuit operator stops the
right side from being evaluated...

I was trying to have my if test below trap when
   (1) $j is undef
   (2) $j is [ ]

But apparently "use strict" is too... mmm... strict.

j


$ cat j.pl
use strict;

my $j;
if (not defined $j || scalar @$j == 0) {
   print "yup\n";
}

$ perl j.pl
Can't use an undefined value as an ARRAY reference at j.pl line 4.