On Thu, Sep 08, 2011 at 11:13:02AM +0200, Matthias Leopold wrote:
> 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 a
> "ML" == Matthias Leopold writes:
ML> Am 2011-09-08 10:53, schrieb Uri Guttman:
>>> "ML" == Matthias Leopold 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
Am 2011-09-08 12:22, schrieb John W. Krahn:
Matthias Leopold wrote:
perl -e '$_ = "ao"; tr/"a","o"/"b","p"/; print $_."\n";'
works as (i) expected -> "bp"
from perlop: tr/SEARCHLIST/REPLACEMENTLIST/cds
LIST in SEARCHLIST and REPLACEMENTLIST refers to a list of characters.
If we rearrange y
Matthias Leopold wrote:
perl -e '$_ = "ao"; tr/"a","o"/"b","p"/; print $_."\n";'
works as (i) expected -> "bp"
from perlop: tr/SEARCHLIST/REPLACEMENTLIST/cds
LIST in SEARCHLIST and REPLACEMENTLIST refers to a list of characters.
If we rearrange your example above:
perl -e '
$_ = "ao";
tr{
Hi,
You might want s/// operator. For example,
$ perl -le '$str="中文";$str=~s/中文/Chinese/;print $str'
Chinese
$ env|grep LANG
LANG=en_US.UTF-8
08 сентября 2011, 12:35 от Matthias Leopold :
> hi,
>
> perl -e '$_ = "äö"; tr/"ä","ö"/"ae","oe"/; print $_."\n";'
>
> expected result: aeoe
> actual
Am 2011-09-08 10:53, schrieb Uri Guttman:
"ML" == Matthias Leopold 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
> "ML" == Matthias Leopold 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. and it can't replace 1
char with 2. you need s/// for that. this works (as i