in reply to How to remove underscore before every dot using perl?
Hello finddata,
For the transliteration operator, the /c modifier complements the searchlist, and the /d modifier causes found-but-not-replaced characters to be deleted. So the expression tr/a-zA-Z//dc says: Delete any character that is not a letter. But that includes the dot. So you need to add in a dot, to say: Delete all characters except letters and dots:
$str =~ tr/a-zA-Z.//dc;
But in this case I think it would be clearer to use an explicit substitution:
$str =~ s/_\././;
Hope that helps,
Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In Section
Seekers of Perl Wisdom