A very simple password checker. : Compare « String « Perl






A very simple password checker.

    

#!/usr/local/bin/perl 
print ("Enter the secret password:\n"); 
$password = "bluejays"; 
$inputline = <STDIN>; 
chop ($inputline); 
$outputline = $inputline eq $password ? 
"Yes, that is the correct password!\n" : 
"No, that is not the correct password.\n"; 
print ($outputline); 

   
    
    
    
  








Related examples in the same category

1.Compare two words with cmp
2.Comparing Strings
3.String comperison operator: cmp
4.String comperison operator: equal
5.String comperison operator: gt (greater than)
6.String comperison operator: lt (less than)
7.The correct use of three of the operators: eq, it, and gt.
8.Check password