Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: How to create a new array with the same name as an existing one in a loop?

by ikegami (Patriarch)
on Aug 15, 2021 at 20:42 UTC ( [id://11135866]=note: print w/replies, xml ) Need Help??


in reply to How to create a new array with the same name as an existing one in a loop?

Just create the array in the loop instead of outside the loop.

my %current_main_record; for my $x (qw(foo bar baz)) { my @role_records; # New array. for my $y (qw(zip zap zop)) { push @role_records, $y; } $current_main_record{"role_data"} = \@role_records; }

Seeking work! You can reach me at ikegami@adaelis.com

  • Comment on Re: How to create a new array with the same name as an existing one in a loop?
  • Download Code

Log In?
Username:
Password:

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

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

    No recent polls found