Skip to content

Instantly share code, notes, and snippets.

@sashaphanes
Created October 2, 2012 17:27
Show Gist options
  • Save sashaphanes/3821416 to your computer and use it in GitHub Desktop.
Save sashaphanes/3821416 to your computer and use it in GitHub Desktop.
Guess a silly password
#!user/bin/perl
use strict;
use warnings;
my $password = 'poops!';
print "Please enter your guess:\n";
my $guess = <STDIN>;
chomp $guess;
while ($guess) {
if ($guess ne $password) {
print "That's not correct. Try again. \n";
$guess = <STDIN>;
chomp $guess;
}
else {print "You got it! This program will now terminate.\n\n";
exit;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment