hashes' ordered keys [was: "Re: S5 tr concern"]

2004-09-08 Thread Michele Dondi
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

Re: S5 tr concern

2004-08-27 Thread Luke Palmer
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

S5 tr concern

2004-08-27 Thread Aaron Sherman
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'