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?? |
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? 🦛
In Section
Seekers of Perl Wisdom
|
|