$var =~ tr/\\//d; # \ deleted, nothing to replace $var =~ tr/\\/X/d; # changed \ into X