in reply to Re: Re:{2} Getting impossible things right (behaviour of keys)
in thread Getting impossible things right (behaviour of keys)
Your code doesnt actually sort the words by length. (Yes I _am_ deliberately storing the length before I quotemeta it.)my $regex=join '|', map {substr $_,2} sort {$a cmp $b} map {pack "SA*",length($_),quotemeta($_)} keys %su +fdata;
:-)
Update
Thanks to Amoe I reexamined this and realized I missed an opportunity for lazyness that geeky virtue:
Although IIRC perl will optimize the first into the second anyway, it does save about 10 chars or so..my $regex=join '|', map {substr $_,2} sort map {pack "SA*",length($_),quotemeta($_)} keys %su +fdata;
Update2
Tilly kindly supplied the link (see replies to this post). However the name I had in mind is the GRT or Guttman Rosler Transform.
DeMerphq / Yves
--
Have you registered your Name Space?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re (tilly) 6: Getting impossible things right (behaviour of keys)
by tilly (Archbishop) on Oct 24, 2001 at 15:34 UTC | |
Re: Re: Re: Re:{2} Getting impossible things right (behaviour of keys)
by blakem (Monsignor) on Oct 24, 2001 at 21:35 UTC | |
by demerphq (Chancellor) on Oct 25, 2001 at 00:11 UTC | |
by blakem (Monsignor) on Oct 25, 2001 at 01:49 UTC |