in reply to Re: Re: Using 'and'
in thread Array Woes
#!/usr/bin/perl use strict; use warnings; use IO::Socket::INET; my @host = qw[ 192.168.1.3 192.168.46.2 ]; my $port = 22; foreach (@host) { check($_, $port); } sub can_connect { my ($ip, $port) = @_; return ! !IO::Socket::INET->new( PeerAddr => $ip, PeerPort => $port, Proto => 'tcp', timeout => 10, ); } sub check { my ($ip, $port) = @_; my $can_connect = can_connect($ip,$port); print "$ip is "; print "NOT" unless ($can_connect); print " listening on port $port\n"; return $can_connect; } sub check_variation { my $can_connect = can_connect(@_); print "$ip is "; print "NOT" unless ($can_connect); print " listening on port $port\n"; return $can_connect; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re^3: Using 'and'
by agentv (Friar) on Dec 12, 2002 at 23:50 UTC | |
|
Re^4: Using 'and'
by LAI (Hermit) on Dec 13, 2002 at 14:50 UTC | |
by tadman (Prior) on Dec 13, 2002 at 18:00 UTC |