in reply to Logical Not not working!!!

Why do you expect zero specifically?

The false value typically returned by Perl is a special value that's "" when treated as a string and 0 when treated as a number.

$ perl -wle'my $x = !1; print "".$x; print 0+$x;' 0 $ perl -wle'my $x = ""; print "".$x; print 0+$x;' Argument "" isn't numeric in addition (+) at -e line 1. 0 $ perl -wle'my $x = 0; print "".$x; print 0+$x;' 0 0

Replies are listed 'Best First'.
Re^2: Logical Not not working!!!
by baski (Novice) on Aug 20, 2010 at 21:49 UTC
    I am using it check the results later in the code..but thanks guys!!
      You apparently have a boolean, so checking involes using
      if (!$value)
      instead of
      if ($value == 0)

      Mind you, the latter would work fine with !1 as well, so I don't see the problem.

      If need to format it to print it, you can use the conditional operator.

      print("value = ", $value?"true":"false", "\n");

      But there's no need to format it until it's time to output it.