#!/usr/local/bin/perl

$passwd = crypt ("bluejays", "ez");
$try = 1;
while (1) {
        print ("Enter the secret password:\n");
        system ("stty -echo");
        $guess = <STDIN>;
        system ("stty echo");
        if (crypt ($guess, substr ($passwd, 0, 2))
                eq $passwd) {
                print ("Correct!\n");
                last;
        }
        if ($try == 3) {
                die ("Sorry! Goodbye!\n");
        }
        print ("Try again -- ");
        $try++;
}
