tz/// will treat .xml as four different independent character and tries replace occurrence of each character with nothing, as a result of which your output string does not have dots in it.Which is not the case with s/// as it consider .xml as a single string and replace the combined occurrence with nothing.