in reply to subroutine return ternary output

Your "0 eq system" is troublesome; most places where perl returns a false boolean result use a special value that's "" in string context and 0 in numeric context. If you try to do a string compare against zero, it will always fail:
# both of these print nothing perl -we'$x = 1; print "hmm" if 0 eq not $x' perl -we'$x = 0; print "hmm" if 0 eq not $x'
System is an exception to this since it actually returns the number 0, which is "0" in string context, but it's still a bad habit to get into. At least make it 0 ==, not 0 eq.

Replies are listed 'Best First'.
Re^2: subroutine return ternary output
by earl_the_perl (Novice) on Sep 08, 2004 at 13:15 UTC
    Thanks ysth,
    I have updated the condition to do a numerical comparison. My focus was on the ternary operator, so I brain farted and used the string operator.