develooper Front page | perl.fwp | Postings from November 2007

fun with hashes!

Thread Next
Uri Guttman
November 23, 2007 10:13
fun with hashes!
Message ID:

too long has this list been quiet. but i have a fun question. i am
writing up slides for an all about hashes class. one goal i have is to
list and explain as many different uses for hashes as reasonably
possible. i have a short list to start with but i am sure the hive mind
of fwp can scrape up a bunch more. each one should have a name and not
overlap too much with any of this list (my initial list should be
obvious to you).

	dispatch table

		call code ref based on a key

		is a key valid? (not same as in a set). isa usually works on
		fixed sets of keys

		my @foos = qw( axxj djdj whwh ) ;
		my %is_a_foo = map { $_ => 1 } @foos


		short month to long month


		single row from a db or similar

	data structures

		hash refs are the core to most deeper data structures


		set of active objects in a class. plenty of other examples

	sparse arrays

		saves major space when you have very few entries in a
		very large array.



Uri Guttman  ------  --------
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs  ----------------------------

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About