Front page | perl.fwp |
Postings from November 2007
Re: fun with hashes!
Thread Previous
|
Thread Next
From:
Uri Guttman
Date:
November 23, 2007 14:41
Subject:
Re: fun with hashes!
Message ID:
x7zlx4mvp7.fsf@mail.sysarch.com
>>>>> "SHC" == Shawn H Corey <shawnhcorey@magma.ca> writes:
SHC> # Unqiueness
SHC> {
SHC> my @list = qw( a b c x y z a b c );
SHC> my %unique = ();
SHC> @unique{@list} = @list;
SHC> @list = keys %unique;
SHC> print "@list\n";
SHC> }
SHC> # Counts
SHC> {
SHC> my @list = qw( a b c x y z a b c );
SHC> my %counts = ();
SHC> $counts{$_} ++ for @list;
SHC> print "$_ : $counts{$_}\n" for keys %counts;
SHC> }
both good ones that i should have remembered. i will add them to the
list.
thanx,
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
Thread Previous
|
Thread Next