How does one compare single character strings in Perl? Right now, I'm tryin to use "eq":
print "Word: " . $_[0] . "\n";
print "N for noun, V for verb, and any other key if the word falls into neither category.\n";
$category = <STDIN>;
print "category is...." . $category . "\n";
if ($category eq "N")
{
print "N\n";
push (@nouns, $_[0]);
}
elsif($category eq "V")
{
print "V\n";
push (@verbs, $_[0]);
}
else
{
print "Else\n";
push(@wordsInBetween, $_[0]);
}
But it isn't working. Regardless of the input, the else block is always executed.