koknat has asked for the wisdom of the Perl Monks concerning the following question:
I want to call a function, passing in a reference to a part of the array
I thought this would work, but I get the error$w = "xyz"; &myfunc($a_ref->$w);
# My workaround my %a = %$a_ref; my %b = %{$a{$w}}; my $b_ref = \%b; &myfunc($b_ref);
The workaround does exactly what I want, but it's ugly and eats up memory and CPU cycles. Is there a better way?
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Hash reference
by Transient (Hermit) on Jun 03, 2005 at 22:19 UTC | |
by koknat (Sexton) on Jun 03, 2005 at 23:27 UTC | |
by monarch (Priest) on Jun 04, 2005 at 00:40 UTC | |
|
Re: Hash reference
by djohnston (Monk) on Jun 03, 2005 at 22:31 UTC |