in reply to Re: Hash printing problem
in thread Hash printing problem

map {my $key = $_; $key =~ s/^([a-z]+­).*/$1/i; push @{$alphaKe­ys{$ke +y}}, $_} keys %hoh;

Obfuscatory map in void context. I especially like the ", $_" you threw on the end so that map would return something meaningful (but useless) to its void context.

for( keys %hoh ) { push @{ $alphakeys{ (/^([a-z]+)/)[0] } }, $_; }

Though I'm guessing this is just a result of an incomplete refactoring.

- tye        

Replies are listed 'Best First'.
Re^3: Hash printing problem (map => for)
by GrandFather (Saint) on Mar 06, 2006 at 19:46 UTC

    Opps. Yes you are right. There had been an assignment to an array, but it turned out messy. The array went, but not some of the cargo :).

    Thanks for pointing it out. Fixing a couple of transcription errors and turning things around a little I'd write it as:

    push @{$alphaKeys{(/^([a-z]+)/i)[0]}}, $_ for keys %hoh;

    DWIM is Perl's answer to Gödel