sub get_service { open (SERVICES, "/etc/services") || die "$!\n"; while (my @SVCS=) { 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]);