#!/usr/local/bin/perl open (PASSWD, "/u/jqpublic/passwd") || die ("Can't open password file"); $passwd = <PASSWD>; chop ($passwd); close (PASSWD); $mypasswd = "asdf"; if (crypt ($mypasswd, substr($passwd, 0, 2)) eq $passwd) { print ("Correct! Carry on!\n"); } else { die ("Incorrect password: goodbye!\n"); }