Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Trying to access array within hash

by ig (Vicar)
on Jun 04, 2013 at 07:11 UTC ( [id://1036913]=note: print w/replies, xml ) Need Help??


in reply to Trying to access array within hash

You may have good reason for making copies of arrays in your broader application, but in the example the copies are not necessary. You might consider:

$policies{$ruleNum} = [ $ruleName, $srcZone, \@srcList, $dstZone, \@ds +tList, \@svcList, $ruleAction ];
sub get_address_policies { my $targetAddr = shift; my $targetType = shift; my $targetRole = shift; foreach my $policy (keys %policies) { my $polMembers = $policies{$policy}[ (lc($targetRole) eq "source") ? 2 : 4 ]; foreach my $polMember ( @{$polMembers} ) { print "$polMember\n"; } } }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1036913]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (4)
As of 2024-04-24 13:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found