No need to crosspost. Don't post HTML. At 05:19 PM 8/14/2006 -0400, Mark Funk wrote: >I have a list that I need to parse through and perform a ping against. >@PINGONLY = >172.22.159.100 >172.23.55.18 >172.16.*.100 >208.171.58.* >Code example... > if (grep(/^$priv_ip/, @PINGONLY)) { >If 172.16.22.100 comes up if fails the test against 172.16.*.100
U need to flip ur matching logic and use the @pingonly as the test against the test ip. The @pingonly should be a regex list rather than the globbing format u have. But it can be converted on the fly. @regexes = map { s/\./\\./g and (s/\*/\\d{1,3}/g or $_) and $_ } @pingonly; print join "\n", @regexes; $regex = "(" . join(")|(", @regexes) . ")"; print "\n$regex\n"; if ($testip =~ m/$regex/) { &pingthing; } __END__ -- REMEMBER THE WORLD TRADE CENTER ---=< WTC 911 >=-- "...ne cede malis" 00000100 _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs