On 10-09-14 11:23 AM, Noah wrote:
Hi there,

I am trying to figure out how to use grep in a particular situation.
The line is:

next unless grep ($fromdevice, @sitenamekeys);


but I am not quite matching properly.

@sitenamekeys = /ABC DEF GHI/;

and $fromdevice could be something like "device1.abc" or "device2.def"
basically I am trying to get the grep to identify if the current
$fromdevice has anything that matching any of the elements in @sitenamekeys

So "device1.abc" or "device2.def" would be a match and therefore would
continue without next but something like "device1.xyz" would not match
and therefore next would be executed.

Any help is appreciated.

Try:

next unless grep { m{ \q$fromdevice\E }msx } } @sitenamekeys;


--
Just my 0.00000002 million dollars worth,
  Shawn

Programming is as much about organization and communication
as it is about coding.

The secret to great software:  Fail early & often.

Eliminate software piracy:  use only FLOSS.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to