if($str=~/[ATCG]+([ATCG])\.+$/) { $last_char=$1; $rightmost_position_of_letter = rindex($str, $last_mapped_char); }