|Perl Monk, Perl Meditation|
Re: Data structure transformationby araqnid (Beadle)
|on Apr 07, 2001 at 20:29 UTC||Need Help??|
I can't eliminate the need for a temporary hash: having attempted it, I'm inclined to think it's not a nice thing to do, since you always seem to end up needing to collate as a side-effect of iterating over the input... Anyway, here's what I got:
(Subquestion: is that constuct I used in the foreach() what's called a Schwartian transform?)
(Subanswer: It isn't)
Clearly I'm insufficiently awake. %collate can be built like this:
The transform is redundant.
tilly suggested I point out that the code doesn't work on older Perls, even 5.005.
Afaict, the changes for perl 5.005 would be: