PERL based log analyzer
SourceForge.net Logo
Home Home Contact us Contacts
Overview Documentation Downloads Contacts Links
 
News & Updates
 
July 21, 2008
v 1.0 now available
Quick Links
 
Sourceforge project's page
CeCILL license
CEA web site
Using Hash-tables next up previous contents
Next: using variables within variables Up: Using the variables Previous: How can I use   Contents

Using Hash-tables

Hastables are 'associative arrays of variables'. This is a set of variable to be accessed using a key. Since hashtable are widespread in PERL, it was easy to implement them into Kazimir. Using hastable is very similar to using variables only the syntax differs. When a variable looked like $(var), an entry of a hashtable will look like $(hash["key"]). In this "key" can be a string or a variable, so it allowed to have syntax like $(hash[ $(key) ]).

Hastable entries can be initialized one by one using the 'Variable' tag. But if you have to initialize ten items then you will have to it ten times. So the following lines are a correct syntax:

Variable: Name = hash[ "value0" ] ; Default =  0 ;
Variable: Name = hash[ "value1" ] ; Default =  1 ;
Variable: Name = hash[ "value2" ] ; Default =  2 ;

For the moment, hashtables can not be used recursively in order to be keys for other hashtables. I mean that a syntax like $(h1[ $(h2[ "key" ]) ]) is no valid syntax and will produce an error.



Subsections

Philippe Deniel 2008-07-22
Designed by CMG Technologies, adapted by Thomas LEIBOVICI
Design downloaded from Free Templates