sub os_port { foreach (@_) { $sock = new IO::Socket::INET(PeerAddr => $server, PeerPort => $_, Proto => 'tcp'); last if $sock; } $sock; }
Subroutines defined at compile time have package scope so it makes little sense to define them inside a loop. You will never get a new subroutine for each loop iteration.
while (<$sock>) { $sock_string = $_; last; }
Why not just:
$sock_string = <$sock>;
In reply to Re: Let's do it transparently
by jwkrahn
in thread Let's do it transparently
by rustic
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |