sub in_array { $tst_string = shift; foreach ( @_ ) {
if ($tst_string =~
m/$_/) {
return 1;
} } return 0;
} ############################### if (in_array($ip_address,
@excluded)) { #ping } else { #socket } --------------------------------- James Schappet http://www.schappet.com -----Original Message----- I have a list of IP addresses that I
am getting status for. Where possible I will use a socket connection. However, some of the IP addresses I
need to ping. I have a list that I need to parse
through and perform a ping against. The list can look like this: @PINGONLY = 172.22.159.100 172.23.55.18 172.16.*.100 208.171.58.* Does anyone have a nifty grep
example I could use? Code example….. if
(grep(/^$priv_ip/, @PINGONLY)) {
print LOG "Pinging Router: $priv_ip b/c it's in the pingonly
list......\n";
$thread =
threads->create("rtr_ping","priv","$storenum","$priv_ip")->detach; } else
{
$thread =
threads->create("rtr_sock","priv","$storenum","$priv_ip")->detach; } If 172.16.22.100 comes up if fails
the test against 172.16.*.100 TIA, David M. Funk President/CEO Specializing in
Network and Systems Management Solutions Trinity
Solutions Cranberry Phone:
724-316-0721
Fax:
724-772-7889 email: [EMAIL PROTECTED]
|
_______________________________________________ Perl-Unix-Users mailing list Perl-Unix-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs