tcf03 has asked for the wisdom of the Perl Monks concerning the following question:
sub get_service { open (SERVICES, "/etc/services") || die "$!\n"; while (my @SVCS=<SERVICES>) { foreach $_(@SVCS) { chomp ($_); next if ( $_ =~ m/^#+(\s+)?/ ); #skip comments@ beg of line my ($name,$port,undef)=split(/\s+/,$_); next unless ( $port =~ m/\d{1,}\/(tcp|udp)/i ); my ($portnum,$proto=split(\//,$port); } } }
my %service=($name,[$portnum,$proto]);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: returning values from a sub
by Fletch (Bishop) on Jan 06, 2005 at 19:11 UTC | |
by tcf03 (Deacon) on Jan 06, 2005 at 19:40 UTC | |
by tcf03 (Deacon) on Jan 06, 2005 at 19:28 UTC | |
by Eimi Metamorphoumai (Deacon) on Jan 06, 2005 at 19:31 UTC | |
|
Re: returning values from a sub
by fauria (Deacon) on Jan 06, 2005 at 19:57 UTC |