After trying my hand at perl, realizing it was above my head, going back
at starting with python, and now trying again at perl this is my first
(failed) attempt at a user-pass program attempt, except it never accepts
the username.  What is wrong with it?

%up = {
  'kyle' => 123,
  'jason' => 123,
  'chelsea' => 123,
  'john' => 123,
  'cheryl' => 123
};

while (1) {
  print "Please enter your username:  \n";
  $u = <STDIN>;
  chomp($u);
  
  if (exists $up{$u}) {
    print "Please enter your password:  \n";
    $p = <STDIN>;
    chomp($p);
    
    if ($up{$u} eq $p) {
      print "Access granted\n";
    }
    else {
      print "Incorrect password\n";
    }
  }
  else {
    print "Incorrect username\n";
  }
};

Thank you,
--
Kyle

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to