atistler has asked for the wisdom of the Perl Monks concerning the following question:
#!/usr/bin/perl use IO::Socket::INET; my @array; my $sock = IO::Socket::INET->new( LocalAddr => 'loghost', LocalPort => 514, Proto => 'udp') or die "Cant establish socket"; die "Fork failed: Damn it!!!\n" unless defined($kid = fork); if ($kid) { while (<$sock>) { print "SOCKIN: $_\n"; push ( @array, $_ ); } } else { while (@array)) { my $firstelem = shift (@array); print "$firstelem\n"; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Forking to read and write to an array
by Zaxo (Archbishop) on Jun 23, 2006 at 03:17 UTC | |
|
Re: Forking to read and write to an array
by NetWallah (Canon) on Jun 23, 2006 at 04:57 UTC | |
|
Re: Forking to read and write to an array
by sgifford (Prior) on Jun 23, 2006 at 03:45 UTC |