On Wed, Aug 22, 2001 at 12:21:29PM -0700, Dan Grossman wrote:
> > eval "tr/$lettertochange/$lettertochangeto/";
>
> Does this mean that I have to use $_ for such a translation, or is
> there a way to modify a string inside an eval?
Here's a complete example:
#!/usr/local/bin/perl -w
use strict;
my $from = "abc";
my $to = "xyz";
my $str = "abc123cba";
print $str;
eval "\$str =~ tr/$from/$to/";
print " => $str\n";
__END__
This prints:
abc123cba => xyz123zyx
--
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]