vicearl has asked for the wisdom of the Perl Monks concerning the following question:
I didn't understand why the results would be different when printing out $string1 and $string2 in below script. I thought the 'tr' operator would work the same way on both strings. Please help! The result from printing $string1: "b b b." The result from printing $string2: " ."
#!/usr/bin/perl $string1 = 'the cat sat on the mat.'; $string1 =~ tr/a-z/b/d; print "$string1\n"; $string2 = 'the cit sit on the mit.'; $string2 =~ tr/a-z/b/d; print "$string2\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: transliterate on regex
by CountZero (Bishop) on Jun 19, 2013 at 06:07 UTC | |
|
Re: transliterate on regex
by Anonymous Monk on Jun 19, 2013 at 04:42 UTC | |
by ww (Archbishop) on Jun 19, 2013 at 11:47 UTC | |
by choroba (Cardinal) on Jun 19, 2013 at 11:59 UTC | |
by vicearl (Initiate) on Jun 19, 2013 at 05:59 UTC |