>>>>> "ML" == Matthias Leopold <matth...@aic.at> writes:
ML> 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. ML> perl -e '$_ = "ao"; tr/"a","o"/"b","p"/; print $_."\n";' ML> works as (i) expected -> "bp" that is one char to one char which is how tr/// works. it can't replace single chars with multiple chars like you want. and the "" parts are still wrong. they actually don't make any difference here but they are not correct syntax for tr/// ML> from perlop: tr/SEARCHLIST/REPLACEMENTLIST/cds and nowhere does it show comma lists of "" strings inside the //. please read the docs again and learn to use tr/// correctly. >> and it can't replace 1 >> char with 2. ML> perl -e '$_ = "ä"; tr/"ä"/"ae"/; print $_."\n";' ML> that replaces 1 char with 2 show output that it does. it should not work like you think it does. ML> actually, the code i'm trying to replace uses s///. i wanted to use ML> something similar to str_replace() in php which uses two arrays for ML> search and replace (in the php version of the very same task in my ML> project). but i admit that i'm not too familiar with tr/// and even ML> unicode (although living in "Österreich"/Austria ;-)) tr/// will not do what you want. you have to accept that and also use the correct syntax. -- Uri Guttman -- uri AT perlhunter DOT com --- http://www.perlhunter.com -- ------------ Perl Developer Recruiting and Placement Services ------------- ----- Perl Code Review, Architecture, Development, Training, Support ------- -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/