Thank You jptxs for fixing up my post.
Thank You tilly and chromatic for your very insightful suggestions. I have to say that i had blindly copied (almost line by line) that encryption subroutine from Java. I completely disregarded the power of perl (i guess i was in the Java mindset and did not look at the problem thinking in Perl). I am almost ashamed of the previous code now that it reads like this in Perl:
sub encrypt {
my $string = shift;
$string =~ tr/a-mN-ZA-Mn-z0-9.&@=/H-Mn-z0-9.&@=a-mN-ZA-G/;
return $string;
}