# deal with absence of pwfile. unless ( -e $passwd ) { # PANIC, quit, etc. die("No passwd file found"); } # open file handle for read open(PASSWD, $passwd) or die("Cannot open passwd file for read."); # push each entry into an array while () { # remove the trailing \n chomp $_; # add line to array push (@pwfile, $_); } #close the file handle. close(PASSWD);