Jason wrote, on Monday, December 04, 2000 19:51
: i always get confused doing this, but maybe this will at least
: inspire some
: ideas. you can use pointers instead of looping through the hash again:
:
: foreach $scheme_key (keys %scheme_hash) {
: my (%temp) = calc_function($scheme_key);
: $scheme{$scheme_key} = \%temp;
: }
:
: i tried before to do it skipping the %temp hash step, but that produces
: strange results (like you get multiple copies of the same hash). getting
Did you try
$scheme{$scheme_key} = { calc_function($scheme_key) };
(i.e., use an anonymous hash constructor)? It may not work,
but it's worth a try to see.
: the values back is usually where i am confused, so here's the
: three possible
: ways i think you can get them back:
:
: # this would be nice - i don't know if it will work, though:
: my ($value) = $scheme{$scheme_key}{'whatever'};
Yes.
: # or maybe:
: my ($calc_hash) = $scheme{$scheme_key};
: my ($value) = $calc_hash{'whatever'};
NO! This way, you need $calc_hash->{'whatever'}.
: # or even:
: my (%calc_hash) = %$scheme{$scheme_key};
: my ($value) = $calc_hash{'whatever'};
Yes.
Joe
==============================================================
Joseph P. Discenza, Sr. Programmer/Analyst
mailto:[EMAIL PROTECTED]
Carleton Inc. http://www.carletoninc.com
219.243.6040 ext. 300 fax: 219.243.6060
Providing Financial Solutions and Compliance for over 30 Years
_______________________________________________
Perl-Win32-Web mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web