Someone correct me if I am wrong, the numbers in quotes are being read as
strings and not numbers, or numbers not strings.
The == works with numbers, and the quotes are for strings. I think that the
way you have it set up, the number one is returning true when the $variable
is defined.

respectfully,
James


-----Original Message-----
From: Catriona Wordsworth [mailto:[EMAIL PROTECTED]
Sent: Wednesday, August 20, 2003 8:03 AM
To: [EMAIL PROTECTED]
Subject: elsif issues ....still


Hi Guys,

trying to get the following code to print each line where relevant....but it
only prints the first statement "yes its one!"  even if the $variable is
"5"....

$variable = $var

if ($variable == "1"){

print MAIL "yes its one!\n";

} elsif ($variable == "2"){

print MAIL "it is two!\n";

} elsif ($variable == "3"){

print MAIL "the number three.\n";

} elsif ($variable == "4"){

print MAIL "4 is on the cards.\n";

} elsif ($variable == "5"){

print MAIL "number 5 is alive.\n";

} elsif ($variable == "6"){

print MAIL "pick up sticks.\n";

} elsif ($variable == "7"){

print MAIL "go to heaven.\n";

} else {

print "this is not working\n";

}





any ideas where I might be going wrong?  I copied this direct out of my perl
book....theoretically it should work right??

regards

Cat

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

Reply via email to