At 11:38 am +0900 9/4/01, Nobumi Iyanaga wrote:
>
>$str = "aiueokakikukeko";
>$to_find = "aiueo";
>$replace_with = "hijkl";
>$str =~ tr/$to_find/$replace_with/;
>print $str, "\n";
#!/usr/bin/perl -w
use strict;
my $str = "aiueokakikukeko";
my $to_find = "aiueo";
my $replace_with = "hijkl";
$str =~ tr/$to_find/$replace_with/;
print $str, "\n";
prints: aaueekakakukeke
So I suppose the answer is yes, though I suspect you'd probably want
to substitute rather than translate:
$str =~ s/$to_find/$replace_with/;
...
prints: hijklkakikukeko
Use the g modifier if you require multiple (global) substitutions:
$str =~ s/$to_find/$replace_with/g;
--
My brain hurts!
SeanC
Mediatek Training Institute
26 Crart Ave., Berea, Durban, South Africa
<-- New Address
phone: +27 (0)31 202 1886 [EMAIL PROTECTED] <--
New Phone Number
fax: +27 (0)31 202 1767
<-- New Fax Number
<http://members.nbci.com/s_carte/>