Yesterday I spend some hours getting pugs to understand
translitterations with multiple ranges in each pair. E.g.
"foobar".trans( "a-z" => "n-za-n" );
By accident I tested something like:
"foobar".trans( ['a' .. 'z'] => "n-za-m" );
and it didn't work.
The problem is that ['a' .. 'z'] gets stringified to 'a b c d ...'
which gets 'b' translated to the third letter in the right hand side.
Is this supposed to work and if so how should the code differ between
"foobar".trans( ['a' .. 'b'] => '12'); # a=>1, b=>2
"foobar".trans( "a b" => "123" ) # a=>1, ' '=>2, b=>3
Same problem ocurs if left hand side is a string and right hand side
is an array reference but in this case the code implementing trans can
see it.
--
Peter Makholm | Why does the entertainment industry wants us to
peter@makholm.net | believe that a society base on full surveillance
http://hacking.dk | is bad?
| Do they have something to hide?
Thread Next