Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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

by hippo (Bishop)
on Aug 16, 2021 at 08:35 UTC ( [id://11135871]=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?

But when I clear the array, it's clearing the array that I already added to the hash.

But you didn't add the array to the hash, you added a reference to the array. When you change the contents of the array you will see the change whether you look in the array directly or via the reference. See perlreftut for an intro to references and perldsc for more complicated structures.

Why not build your data directly into $current_main_record{role_data} instead of using an intermediate?


🦛

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2024-03-28 11:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found