You need to chomp your input to remove the newline character:
$seq = <>;
chomp $seq;
$rev = "string";
if ($seq eq $rev){
print "The two strings match.\n";
}
else {
print "The two strings do NOT match.\n";
}
Also, use print
instead of printf
since you are not specifying a format.