in reply to I'm confused with Bitwise Operators
Operator && is logical and, not bitwise, which is '&'. Logical && is the correct choice for what you're doing. See perlop for details, but it acts [almost] like the C operator of the same name. The left argument is evaluated. If false, the right argument is ignored and the whole && expression returns false. If the left evaluates true, the right hand argument is evaluated and that result returned.
Your code is correct as far as perl goes, though the '$_ =~' is unneeded - $_ is the default argument for m//. You will get some surprises, however, when $service[0] is numeric and $_ contains a dotted quad ip matching the service you're looking for. A single regex containing more context is in order, or else perhaps a split to a predictable array.
Update: Doh! dws is on the money with the operator precedence issue.
After Compline,
Zaxo
|
|---|