On Fri, 27 Aug 2004, Luke Palmer wrote:
> > $downcaserule = 'A-Z' => 'a-z';
> > $l33trule = 'EISTA' => '31574';
> > $str =~ tr( { $l33trule, $downcaserule } );
> >
> > may or may not do what the naive reader expects, and randomly so!
[snip]
> or not. the point is that it's only undef
Aaron Sherman writes:
> Specifically, hashes do not maintain ordering, so a program like this:
>
> $downcaserule = 'A-Z' => 'a-z';
> $l33trule = 'EISTA' => '31574';
> $str =~ tr( { $l33trule, $downcaserule } );
>
> may or may not do what the naive reader expects, and randomly so
In S5, the following is stated:
The tr/// quote-like operator now also has a subroutine form.
* It can be given either a single PAIR:
$str =~ tr( 'A-C' => 'a-c' );
* Or a hash (or hash ref):
$str =~ tr( {'A'=>'a', 'B'=>'b', 'C'