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); }