Basic HTML version of Foils prepared Sept 20 97

Foil 31 Hashes -- Examples

From Tutorial on PERL Computational Science for Information Age Course CPS616 -- Sept 20 97. by Geoffrey C. Fox,Nancy McCracken,Tom Scavo


One can think of a hash as a simple relational database with two columns and multiple rows labelled by keys
For example, hashes can be used to store data defined by MIME or HTTP as these protocols are specified in terms of a set of header statements
  • Content-type: text/plain # corresponds to
  • $mime{Content-type} = "text/plain"; # and so on
Similarly this data type can be used to store values read as 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 Sun Sep 21 1997