in reply to variable sees it, array doesn't - stumped!

Since you seem to be using warnings and strictures, I'm surprised that you got no warning messages when you ran your code, e.g.:
>perl -wMstrict -le "my $s = ''; if ($s != '') { print 'not equal' } " Argument "" isn't numeric in numeric ne (!=) at -e line 1. Argument "" isn't numeric in numeric ne (!=) at -e line 1. >perl -wMstrict -le "my $s = 'foo'; if ($s != '') { print 'not equal' } " Argument "" isn't numeric in numeric ne (!=) at -e line 1. Argument "foo" isn't numeric in numeric ne (!=) at -e line 1. >perl -wMstrict -le "my $s = 0; if ($s != '') { print 'not equal' } " Argument "" isn't numeric in numeric ne (!=) at -e line 1. >perl -wMstrict -le "my $s = [ 'array', 'ref' ]; if ($s != '') { print 'not equal' } " Argument "" isn't numeric in numeric ne (!=) at -e line 1. not equal

Replies are listed 'Best First'.
Re^2: variable sees it, array doesn't - stumped!
by tilly (Archbishop) on Dec 31, 2008 at 20:04 UTC
    Warnings would go to the log file. Odds are good that the OP doesn't know where that is and/or didn't think to look there.
      The OP sees it now! Thanks for the tip.