in reply to Re: Re: globbing,file handles and subroutines
in thread globbing,file handles and subroutines
See? no alterations need to be made and the handles name is local to the sub routine.. the actual handle is still global I believe in this case, so I wouldnt suggest trying to have multiple sub routines reading the same handle at the same time..use strict; use IO::Socket; my $sock = IO::Socket::INET->new( PeerAddr => '127.0.0.1', PeerPort => '25', Proto => 'tcp', Type => SOCK_STREAM ); do_mail($sock); print $sock "quit\n"; close($sock); sub do_mail { my($handle) = shift; my $buf = <$handle>; print "Sendmail ", $buf ? "is OK\n" : "is not responding\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: globbing,file handles and subroutines
by drake50 (Pilgrim) on Mar 15, 2003 at 04:57 UTC |