Why doesn't my string equality test for a single character work?
comparison, perl, string
Solution
How are you accepting the value of `$category`? If it is done like `my $category = <STDIN>`, you will have to chomp the newline at the end by:
chomp( my $category = <STDIN> );
Problem
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.