From: [EMAIL PROTECTED]
> I have the statement and I would like if someone could verify the
> logic here. Precedence is left to right and =~ is higher than & and ||
> while & is higher than ||.
>
> if ( (($_ =~ /9840S/) && ($_ =~ /ebexpire, ebexpire/)) && (($_ =~ $dm)
> || ($_ =~ $dmm)) ) {
>
> This statement is saying "if variable $_ matches 9840S and $_ matches
> ebexpire, ebexpire first both have to be true then return 1 if $dm is
> matched or $dmm is matched.
>
> is my above English statement correct?
With this many braces the precedence of the operators doesn't matter.
I would read it as "if it contains "9840S" and "ebexpire, ebexpire"
and matches either $dm or $mm do ...", but I think that if I read
your sentence correctly, yes you do understand it currectly.
And I would probably write it like this:
if ( /9840S/ and /ebexpire, ebexpire/ and ($_ =~ $dm or $_ =~ $dmm) )
{
Looks a wee bit more readable to me :-)
Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>