Re: fun with hashes!
[email protected] (Uri Guttman) Fri, 23 Nov 2007 17:41:08 -0500
| Newsgroups | perl.fwp |
|---|---|
| Message-ID | <[email protected]> |
>>>>> "SHC" == Shawn H Corey <[email protected]> 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 ------ [email protected] -------- http://www.stemsystems.com --Perl Consulting, Stem Development, Systems Architecture, Design and Coding- Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org