#! perl -slw use strict; sub port_definition{ my( $port, $def ) = shift; #open FILE, '<', .... local $/ = '#-------------------------------------------'; 1 until ($def = ) =~ m[Port $port]; return $def; } print port_definition 123 ; __DATA__ Port 119 NNTP * Microsoft Ports-Microsoft Exchange supports a News server running at this port. * RFC977 * RFC1036 #------------------------------------------- Port 120 CFDP (UDP) Coherent File Distribution Protocol (CFDP) * RFC1235 #------------------------------------------- Port 123 NTP (UDP) NTP (Network Time Protocol) * RFC2030 * RFC1129 #-------------------------------------------