in reply to Re: doing tr/// on-the-fly?
in thread doing tr/// on-the-fly?
Thanks. That helps some.
Changing the code to the following:
Gives me the results:#!/usr/bin/env perl use strict; my $s = 'eabcde'; my $t = $s; print "$t\n"; $t =~ tr/abcd/efgh/; print "$t\n"; print '*' x 4, $/; my $search = 'abcd'; my $replace = 'efgh'; $t = $s; print "$t\n"; eval { $t =~ tr/$search/$replace/; }; print "$search\n"; print "$replace\n"; print "$t\n";
I don't see why the results of tr/// differ.eabcde eefghe **** eabcde abcd efgh epbade
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: doing tr/// on-the-fly?
by ikegami (Patriarch) on Mar 18, 2010 at 04:27 UTC | |
|
Re^3: doing tr/// on-the-fly?
by Anonymous Monk on Mar 18, 2010 at 01:31 UTC | |
by jwkrahn (Abbot) on Mar 18, 2010 at 01:43 UTC |