develooper Front page | perl.perl5.porters | Postings from October 2002

Re: Collections

Thread Previous | Thread Next
From:
H.Merijn Brand
Date:
October 1, 2002 07:00
Subject:
Re: Collections
Message ID:
20021001155156.6DE3.H.M.BRAND@hccnet.nl
On Tue 01 Oct 2002 15:29, Graham Barr <gbarr@pobox.com> wrote:
> > > > I'm happy writing the above replacing the "<--" marked line with
> > > > 
> > > >           $rolls->{"$dice1 $dice2"}++;
> > > 
> > > Nobody mentioned the $; variable yet ?
> > 
> > Or pack?
> > 
> > $rolls->{pack "ll", $dice1, $dice2}++
> > 
> > Verrrry efficient, and ultimate simple to sort :)
> 
> Not id the data structure being used as the key has a huge number
> of elements in it.
> 
> What is being attempted is currently trivial with a tied hash, even getting
> refs etc back from keys. But I suspect people want the core hash todo this.

I got that from the discussion. I only wanted to stress the usefulness of pack
again in `simple' multi-element hash keys. We discussed some performance
issues on YAPC about it, and many people did not (yet) see the graceful
solution pack already offers.

How much I like the idea of allowing anonymous whatever's to act as hash keys
(yes, I realy do) I'd like to see obvious actions on keys do as expected (DWIM)

keys %hash	is a no brainer, it should return the objects, or references
sort keys %hash	is much more difficult to DWIM

-- 
H.Merijn Brand        Amsterdam Perl Mongers (http://amsterdam.pm.org/)
using perl-5.6.1, 5.8.0 & 633 on HP-UX 10.20 & 11.00, AIX 4.2, AIX 4.3,
  WinNT 4, Win2K pro & WinCE 2.11.  Smoking perl CORE: smokers@perl.org
http://archives.develooper.com/daily-build@perl.org/   perl-qa@perl.org
send smoke reports to: smokers-reports@perl.org, QA: http://qa.perl.org



Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About