in reply to Re^3: Using a stored condition
in thread Using a stored condition

Thanks. I was just trying the following simple way:
my $aa=1,$bb=1,$cc=1,$dd=1; my $method1 = '(($aa && $bb)) || ($cc && $dd)'; print "yeah\n" if eval $method1; die $@ if $@;
But it still keeps giving me the same bunch of errors. Am I doing something wrong here?

Replies are listed 'Best First'.
Re^5: Using a stored condition
by shmem (Chancellor) on Mar 02, 2008 at 23:44 UTC
    Am I doing something wrong here?
    Yes. ETOOLAZY:
    my $aa=1,$bb=1,$cc=1,$dd=1;

    That's equivalent to

    my $aa=1; $bb=1; $cc=1; $dd=1;

    Only $aa is declared as lexical. Even parens don't work, since you can't declare an assignment - you declare variables.

    But that's lazy enough:

    my ($aa, $bb, $cc, $dd); $aa = $bb = $cc = $dd = 1;

    --shmem

    _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                  /\_¯/(q    /
    ----------------------------  \__(m.====·.(_("always off the crowd"))."·
    ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
      Am I doing something wrong here?

      Yes. ETOOLAZY:

      my $aa=1,$bb=1,$cc=1,$dd=1;

      That's equivalent to

      my $aa=1; $bb=1; $cc=1; $dd=1;

      Only $aa is declared as lexical. Even parens don't work, since you can't declare an assignment - you declare variables.

      I personally believe ENOTLAZYENOUGH:

      my ($aa, $bb, $cc, $dd) = (1) x 4;

      (Which of course you knew, but may be worth pointing out for the benefit of the OP.)

      --
      If you can't understand the incipit, then please check the IPB Campaign.

        Good. But also:

        $_++ for my( $aa, $bb, $cc, $dd );