Strolling thru' Learning Perl and already have a few q's in mind:

I couldn't quite follow this program off the book. The parts not quite 
clear to me are (the hwole program is given below):

$i = 0;
$correct = "maybe"; {
while ($correct eq "maybe")
{
if ($words[$i] eq $guess){
$correct = "yes";
}
elsif ($i < 2) {
$i = $i + 1;
Anyone would like to help?


----------------------the whole program-----------------------
#!/usr/bin/perl
@words = qw (llama camel alpaca);
print "what is your name\n";
$name = <stdin>;
chomp $name;
if ($name eq "tan") {
print "hey man\n";
}
else
{
print "hi, $name\n";
print "enter the password\n";
$guess = <stdin>;
chomp $guess;
$i = 0;
$correct = "maybe"; {
while ($correct eq "maybe")
{
if ($words[$i] eq $guess){
$correct = "yes";
}
elsif ($i < 2) {
$i = $i + 1;
}
else
{
print "wrong. try again\n";
$guess = <stdin>;
chomp $guess;
$i = 0;
}
}
}}
#EOF.



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

Reply via email to