in reply to Re: globbing,file handles and subroutines
in thread globbing,file handles and subroutines
In the subroutine I could do this:$sock = new IO::Socket::INET( LocalHost => $myip, LocalPort => $port, Proto => 'tcp', Listen => SOMAXCONN, Reuse => 1); $sock or die "no socket :$!"; STDOUT->autoflush(1); #main loop begin { while (($new_sock, $c_addr) = $sock->accept()) { ($client_port, $c_ip) = sockaddr_in($c_addr); $client_ipnum = inet_ntoa($c_ip); $client_host = gethostbyaddr($c_ip, AF_INET); next if $kid = fork; die "fork: $!" unless defined $kid; close $sock; if (&readfromsocket(*new_sock)){
But I want to be able to use another var name in the subroutine.if (defined($lineread = <$new_sock>)) {whatever}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: globbing,file handles and subroutines
by l2kashe (Deacon) on Mar 15, 2003 at 04:08 UTC | |
by drake50 (Pilgrim) on Mar 15, 2003 at 04:57 UTC | |
|
Re: Re: Re: globbing,file handles and subroutines
by drake50 (Pilgrim) on Mar 15, 2003 at 02:57 UTC |