Saturday, May 31, 2014

Password checker

Script

#!/usr/bin/perl

print ("Enter the secret password: ");
$password = "aristocrat123";
$intake = <STDIN>;
chop ($intake);
$outcome = $intake eq $password ?
        "Yes, the password is correct !!! \n" :
        "No, the password is not correct \n";
print ($outcome);

Execution

Enter the secret password: bdtsydo93
No, the password is not correct

Enter the secret password: rvrevre9
No, the password is not correct

Enter the secret password: aristocrat123
Yes, the password is correct !!!

No comments:

Post a Comment