tel2 has asked for the wisdom of the Perl Monks concerning the following question:
Instead of coding this kind of thing:
I was wanting to do recode the last group of lines more elegantly, with something like this:$mailbox = 'inbox'; $subscribe = 'yes'; $country = 'NZ'; $sel_mailbox{$mailbox} = 'test'; $sel_subscribe{$subscribe} = 'test'; $sel_country{$country} = 'test';
But I can see that's not working, because there's nothing in $sel_mailbox(inbox).for (qw(mailbox subscribe country)) { ${"$sel_$_{$$_}"} = 'test' } # <= Not working!!!
Please guide me back to the straight and narrow.
Thanks.
tel2
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Indirect addressing problem
by 1nickt (Canon) on Aug 28, 2015 at 02:01 UTC | |
by tel2 (Pilgrim) on Sep 03, 2015 at 00:09 UTC | |
|
Re: Indirect addressing problem
by parv (Parson) on Aug 28, 2015 at 01:57 UTC | |
by tel2 (Pilgrim) on Sep 02, 2015 at 05:30 UTC | |
by Anonymous Monk on Sep 02, 2015 at 06:44 UTC | |
by parv (Parson) on Sep 02, 2015 at 10:31 UTC | |
|
Re: Indirect addressing problem
by locked_user sundialsvc4 (Abbot) on Aug 28, 2015 at 14:19 UTC |