in reply to Port check - Services File

any pointers for a newbie

Top pointer: use sane indenting. If you had then it would be much clearer that $port is out of scope when you use it at line 48.

Try to provide an SSCCE. That way people can be better informed as to which of your 18 lines is line 48.

Also, arbitrary lines of data such as may be found in /etc/services do not necessarily make valid regular expressions, therefore you should not attempt to use them as such. Consider using split or a pattern match to extract only the port number.

There's no point in trying to analyse the comments in /etc/services, so skip them.

Wrap your error text in <code> tags so that others can read them.

HTH, Hippo

Replies are listed 'Best First'.
Re^2: Port check - Services File
by deelinux (Novice) on Dec 02, 2015 at 15:59 UTC

    many thanks, notes taken onboard