in reply to Re^4: array or array ref as variable
in thread array or array ref as variable
In my opinion, something like this could work ( dropping the sub, in case you don't need that sub for something else):
my (@fw, @vrf, @vlan, @portchannel); my @arr_methods = ([ \@fw, &NT::FW], [\@vrf, &NT::VRF], [\@vlan, &NT:: +VLAN], [ \@portchannel, &NT::PORTCHANNEL] ); foreach (@arr_methods) { @{$_->[0]} = ($_->[1])->extract($content, %CFG); }
I haven't tested it, the right hand-side of the assignment may not work, (but it's close), if it doesn't work, maybe one of the higher gurus here can fix it.
Run it and tell us the result
Helen
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^6: array or array ref as variable
by Hossein (Acolyte) on Jun 28, 2013 at 10:57 UTC |
In Section
Seekers of Perl Wisdom