in reply to Re^2: Grep-Ternary Operator Question
in thread Grep-Ternary Operator Question

Note the lack of 'first' and 'end' in the output.

my $string = qq! first ! . (grep /blivitz/, @array) ? qq! yes ! : qq! no ! . qq! end !;

is

my $string = ( qq! first ! . (grep /blivitz/, @array) ) ? ( qq! yes ! ) : ( qq! no ! . qq! end ! );

You removed a set of parens. See the update I made at the same time you were posting.

Replies are listed 'Best First'.
Re^4: Grep-Ternary Operator Question
by ww (Archbishop) on Oct 05, 2010 at 23:32 UTC
    thank you.

    and with the code per your advice,

    my $string = qq! first ! . ( (grep /blivitz/, @array) ? qq! yes ! : qq! no ! ) . qq! end !; print $string . " -last test, lines 27-30 \n";

    Output is:

    first  no  end  -last test, lines 27-30

    As expected