Hi,

I haven't found the way to make the following snippet work.

$a = 'ABCD'; $b = 'bcda'; $z = 'DCBA';
eval "$z =~ tr/$a/$b/";
print $z, "\n"; # should be adcb
__END__
DCBA

OTOH the following works:

$a = 'ABCD'; $b = 'bcda'; $_ = 'DCBA';
eval "tr/$a/$b/";
print $_, "\n"; # should be adcb
__END__
adcb

What am I doing wrong ? Thanks.

Reply via email to