in reply to Re: scalar values assignment
in thread scalar values assignment

I've read perlintro, and i've tried something like

if ($scalar1! && $scalar2!){ then.... }

still this didn't work. I also don't understand what you mean that I don't have to compare booleans to true or false. I am sorry if my questions seem a bit stupid and thank you for your time to reply to me.

Replies are listed 'Best First'.
Re^3: scalar values assignment
by moritz (Cardinal) on Apr 09, 2010 at 13:12 UTC
    perlintro doesn't mention a then belonging to an if, because Perl is not Visual Basic.

    Just write

    if (defined(param('foo'))) { print "yes, we have a foo\n"; } else { print "out of luck, pal\n"; }
    I also don't understand what you mean that I don't have to compare booleans to true or false.

    The question is $thing the same as true? is nearly the same as is $thing true?. When you write if ($thing) { ... } then perl already asks is $thing true? - no need to make it more complicated by explcitly comparing it to true (which doesn't exist in Perl 5 anyway).

Re^3: scalar values assignment
by Anonymous Monk on Apr 09, 2010 at 13:10 UTC

    The actual error message should be telling you where to look.

    Were you trying to form a NAND operator? !&& isn't legit.
    Also, the not operator (!) needs something to negate at the end of your conditional.