$str = q{TTTTTTT}; $str =~ s/TTT/ttt/i; #### $str = tttTTTT # after the first replacement $str = ttttTTT # after the second replacement .... $str = ttttttt # after all the global matches are said and done