http://www.perlmonks.org?node_id=250586


in reply to What is the difference between s/ and tr/

Transliterate: transliterates all occurrences of the characters found in the search list with the corresponding character in the replacement list. It returns the number of characters replaced or deleted.

Substitute replaces the first regexp with the second.

In your example transliterate changes the new line character (\n) with the character '<'. In your example substitute changes the first regexp (2 new lines) with a HTML break.

  • Comment on Re: What is the difference between s/ and tr/