in reply to Parsing cisco router command output
The above only works if both arrays are populated of course (but will return nothing if an either array is empty). There's probably better ways to do this but it's a good Q&D, hehe...@a = qw(a b c d e f); @b = qw(1 2 c 3 4 f); foreach $foo (@a) { if ( grep /$foo/, @b ) { print "Matched $foo in both arrays\n"; } }
|
|---|