Hi,

I have a problem about grep in Perl.

I'd like to use grep in a if clause like this

if( *grep /^\$/, @array* ){
    ...
}

This works well.
However, when I add some more tests in this if, like this:

if( *0 || grep /^\$/, @array || 0* ){
    ...
}

this if will never be true even when there are strings begin with "$"
@array. And to make this work, I have add () around grep, like this.

 if( 0 || *(grep /^\$/, @array)* || 0 ){
    ...
}

Is this because OR '||' has higher precedence than comma "," in perl ?

Thanks.

Reply via email to