Rob Dixon wrote:

> 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/) )
>
> The /net|gaat/ construct is the most usual one, but this may
> be of some use to you:
>
>     for ( $node ) {
>         if ( /net/ || /gaat/ ) {
>             :
>         }
>     }
>
> which makes use of the 'foreach' loop aliasing each list element
> with $_ within the loop. The loop will only execute once and
> within it you can make use of built-in operators that use $_ as a
> default parameter.
>
> HTH,
>
> Rob

Which is actually logically equivalent to what he had, but typographically neater, 
since the '$_ =~ ' is implicitly tacked on to each operand of the '||'.  ;:-o)

Joseph


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

Reply via email to