thanks a lot for this and thank you for the example script,
David - works propblemless and its even slightly faster.

../allan

Keary Suska wrote:
> 
> on 3/17/02 11:02 PM, [EMAIL PROTECTED] purportedly said:
> 
> > but i dont see how you can use a hash in this case . the
> > variable name could be many different names as it is
> > concatenated dynamically.
> >
> > would you happen to have an example of this?
> 
> David Iberri gave a concrete example according to the code sample you
> provided. In essence, assuming you use the hash %var to store your data,
> where you would use "$$var_name" you would instead use: $var{$var_name}.
> 
> You can think of it as creating your own symbol table in a hash. Using a
> hash also gives you the flexibility of a higher abstraction level. Say you
> want to check the existence of a variable. Normally, you can only check for
> a defined value, but if undef is a valid value for your var, you have no way
> of knowing. Using exists( $hash{key} ) you can tell whether the "variable"
> exists.
> 
> It also gives you more control over memory management, as you can:
>     map( delete $var{"{$_}_append"}, keys %var )
> To delete a set of "variables". Of course, you may need to pay a little more
> attention to scope, if you use this technique for dynamically generated
> variables within a limited scope.
> 
> Also look up the tie() functions for unlimited possibilities!
> 
> Keary Suska
> Esoteritech, Inc.
> "Leveraging Open Source for a better Internet"

Reply via email to