Nov 23, 2012, 8:01 AM
Post #1 of 4
Hi, I am fairly new to perl although i do know bash quite a bit (they are kinda similiar i think).
Simple Yes or no prompt
This is my code:
for ($count = 0; $count < 8; $count++)
my @letters = ('a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z');
print "$letters[int rand @letters]\t";
print "Are you happy with these letters?\n";
print "Type 'y' to move on, or 'n' to get different characters.\n";
It prints a random sequence of 8 chars. I want it to (hence the bottom prints) ask the user if they would like to type y for "that is ok" and move on or n to generate another random sequence for them and ask again.
Can anyone help? ive looked at while, until, unless etc and cant get all of them to work.