Q:

Script returns false regardless of value

I am creating a program that would confirm if a nucleotide sequence given is a palindrome or not. The script creates a reverse complement and compares it to the original sequence, confirming that it is a palindrome should the 2 match. The problem is my script will always state that it isn't a palindrome even though it is.
#!/usr/bin/perl
use strict;

print "Enter the sequence\n";
my $seq = <STDIN>;

my $r=reverse($seq);

$r =~ tr/ACTGactg/TGACtgac/;

print "Reverse complement: $r \n";

if ($r eq $seq) {
    print "The sequence is a palindrome\n";
} else {
    print "The sequence is NOT a palindrome\n";
}

Example of expected output:
Enter the sequence:
CG
Reverse complement:
CG
The sequence is a palindrome

A:

The problem is that after reading from <STDIN>, $seq also contains the final newline.
If you add a chomp($seq); after the line my $seq = <STDIN>;, the script will run as expected.

