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

Re: Collections

Thread Previous | Thread Next
From:
H.Merijn Brand
Date:
October 1, 2002 06:25
Subject:
Re: Collections
Message ID:
20021001152522.6DE0.H.M.BRAND@hccnet.nl
On Tue 01 Oct 2002 15:05, Rafael Garcia-Suarez <rgarciasuarez@free.fr> wrote:
> Damien Neil <neild@misago.org> wrote:
> > >         $roll = [$dice1, $dice2];
> > >         $rolls->{$roll}++;                  <--
> ....
> > 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 :)

-- 
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