in reply to substr Rampage

I gather you are running this on a unix or linux box of some sort. In terms of posting code for monks to look at, you might try running this shell command, and just post the stuff that gets printed to your terminal as a result:
perl -ne 'print unless /^\s*#/' your_script_file
That removes all comments and lines that are commented out. (It also removes the initial "shebang" line, but we don't need to see that anyway.)

I was going to suggest there might be a problem here:

open (PASSWDFILE, "//etc//passwd");
but then I remembered that the OS will automatically ignore repeated slashes in file path strings. Still, you don't need to double the slashes (it's the backslash that needs to be doubled in order to get a literal backslash: \\). And you really should check whether the open() succeeded, even for that file; it's just a good habit.

Welcome to the Monastery!