Possible Duplicate:
How do I compare two strings in Perl?
Why does this script always return "You won"?
print "Choose heads or tails :\n";
$answer = <STDIN>;
chomp $answer;
if( $answer == "heads" ) {
print "You won\n";
}
else {
print "Moron! You lost.\n"
}
And what should be the correct code for the same?