Using tr command I want to convert Hello into Hii.
My command was:
$_="Hello";
print;
tr/Hello/Hi/;
print;
But the result was Hiiii. What did I do wrong?
What is the right way to do it?
To replace Helloby Hii you could use:
s/Hello/Hii/
tr works different. Using tr both character sequences are handled as lists. The first character of the first list is replaced by the first character of the second list. So, H is replaced by H, e is replaced by i and so on.