in reply to Logical expression evaluation

You can format the result of ! easily using the conditional operator:
$f = !$v ? 1 : 0;
or just
$f = $v ? 0 : 1;

Replies are listed 'Best First'.
Re^2: Logical expression evaluation
by radiantmatrix (Parson) on Jul 27, 2005 at 17:00 UTC

    Or, you can instruct Perl in more detail about how you'd like a boolean value to be displayed:

    $v = 0; $f = !($v); printf '**%1d**',$f;

    Read the documentation on printf and sprintf for more.

    <-radiant.matrix->
    Larry Wall is Yoda: there is no try{} (ok, except in Perl6; way to ruin a joke, Larry! ;P)
    The Code that can be seen is not the true Code
    "In any sufficiently large group of people, most are idiots" - Kaa's Law