Ravi Malghan wrote:

> Hello: I seem to have forgotten
>
> Can this statement be shortened
> if(($node =~ /net/) || ($node =~ /gaat/))
>
> The following does not give me the expected results
> if($node =~ (/net/ || /gaat/) )
>
> TIA
> Ravi

Probably not with the || operator.  But read on...

AFAIK, the only shortcut available for = || is if the first element to be tested may 
evaluae false:

my $choice = $user_entry || "Vanilla";

Well, if the user won't make up his mind, $user_entry will be the empty string and 
evaluate false.  Therefore the alternate entry will be evaluated for the assignment.  
The user gets vanilla.

In your case, each alternative does have a value, so this will not work.

The pattern-matching regex alternative operator '|' [NOT binary OR in this context] 
will.

f(($node =~ /net|gaat/)) {

Joseph


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to