Basic HTML version of Foils prepared March 30 97

Foil 30 Associative Arrays -- Examples (Chapter 5 of the Llama Book)

From PERL4 Tutorial for CPS616 Computational Science for Information Age Course CPS616 -- February 1995. by Geoffrey C. Fox


One can think of an associative array as a simple relational database with two columns and rows labelled by keys.
For example, they can be used to keep data defined by MIME or HTTP format message as these protocols are defined in terms of a set of header statements
  • keyname: keyvalue with for example
  • Content-type: text/plain # corresponding to
  • $mime{Content-type} = "text/plain"; # and so on
Similarly this data-type can be used to store values read in arguments of a UNIX command as these are either of form
  • -keyname value # or
  • -keyname # just to indicate option set (value = yes or no)



© Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sat Sep 6 1997