http://qs321.pair.com?node_id=732913


in reply to Re^2: Little annoying mistakes ... of others
in thread Little annoying mistakes ... of others

Wow, I am writing down the examples as test cases but I can't figure out why is the second example always true?

could you please explain?

  • Comment on Re^3: Little annoying mistakes ... of others

Replies are listed 'Best First'.
Re^4: Little annoying mistakes ... of others
by jeffa (Bishop) on Dec 29, 2008 at 14:16 UTC

    I think this:

    print "$arg matches\n" if grep $arg, @valid;

    Is equivalent to this:

    print "$arg matches\n" if grep { $arg } @valid;
    So as long as @valid and $arg are not false, then the match will also be true. (If $arg is 0 (zero) then the second example will not always be true.)

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)