Am 2011-09-08 10:53, schrieb Uri Guttman:
"ML" == Matthias Leopold<matth...@aic.at> writes:
ML> perl -e '$_ = "äö"; tr/"ä","ö"/"ae","oe"/; print $_."\n";'
not that i do unicode much but that tr/// is wrong. it takes a single
string in each part, not lists of "" strings.
perl -e '$_ = "ao"; tr/"a","o"/"b","p"/; print $_."\n";'
works as (i) expected -> "bp"
from perlop: tr/SEARCHLIST/REPLACEMENTLIST/cds
and it can't replace 1
char with 2.
perl -e '$_ = "ä"; tr/"ä"/"ae"/; print $_."\n";'
that replaces 1 char with 2
you need s/// for that. this works (as i said, i am an
ascii bigot! :)
actually, the code i'm trying to replace uses s///. i wanted to use
something similar to str_replace() in php which uses two arrays for
search and replace (in the php version of the very same task in my
project). but i admit that i'm not too familiar with tr/// and even
unicode (although living in "Österreich"/Austria ;-))
matthias
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/