in reply to Re^3: Returning transliteration from eval
in thread Returning transliteration from eval
...but that wouldn't interpolate where interpoplation is needed ($n1, $n2 and $ndiff).
(With single quotes, the resulting code such as ( ~$string1 & $string2 ) =~ tr[$ndiff][$ndiff] would count the total number of characters belonging to the set '$','n','d','i','f' — which is not what is intended here.)
print 'f $ d d i $ n' =~ tr/$ndiff/$ndiff/; # 7
(Update: added sample code for the downvoter, who apparently didn't get it.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Returning transliteration from eval
by Your Mother (Archbishop) on Jan 28, 2011 at 17:21 UTC |