in reply to Re: I'm confused with Bitwise Operators
in thread I'm confused with Bitwise Operators
Regarding the original poster's code:
This works only because $_ is being tested. Taking precedence into consideration (and the fact that m// works on $_ by default), this code is equivalent to$count++ if $_ =~ /\b$dst[0]\b/ && /\b$service[ +0]\b/;
If the data were in any other variable ($var, for example), and one just replaced $_ with $var in the OP's code, it would be equivalent to($_ =~ /\b$dst[0]\b/) && ($_ =~ /\b$service[+0]\b/);
which isn't What You Want.($var =~ /\b$dst[0]\b/) && ($_ =~ /\b$service[+0]\b/);
Just my observations. HTH.
--
There are 10 kinds of people -- those that understand binary, and those that don't.
|
|---|