in reply to Extract Port value from netstat file
while (defined(my $line = <FH>)) { if ($line =~ m/$pattern/) { printf "Port found: %d\n", (split $pattern, $line)[1]; } else { print "No Match\n"; } } [download]