Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL tr /// Function
Syntax
tr/SEARCHLIST/REPLACEMENTLIST/
|
Definition and Usage
This is not a function. This is the transliteration operator; it replaces all occurrences of the characters in SEARCHLIST with the characters in REPLACEMENTLIST.
Return Value
Example
#!/usr/bin/perl -w
$string = 'the cat sat on the mat.';
$string =~ tr/a-z/b/d;
print "$string\n";
|
It will produce following results: Here option d is used to delete matched characters
|

|
|
|