Sixtease has asked for the wisdom of the Perl Monks concerning the following question:
Dear fellows
Can I alias a hash entry to a global variable? I'd like something like this to happen:
our @arr; my %h; somehow_alias($h{'key'}, @arr); $h{'key'}[0,1] = qw(hello world); print $arr[0], ' ', $arr[1], "\n"; # Desired output: # hello world
Now that's the Y part. The X part is that I'm running user-provided subrefs in a module and would like these subs to see some fields that the $self object has without messing with the sub's parameters.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: aliasing a hash field
by BrowserUk (Patriarch) on Feb 15, 2008 at 18:06 UTC | |
|
Re: aliasing a hash field
by kyle (Abbot) on Feb 15, 2008 at 16:58 UTC | |
|
Re: aliasing a hash field
by Sixtease (Friar) on Feb 15, 2008 at 20:24 UTC |