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 reply to Re: How to create a new array with the same name as an existing one in a loop?
by hippo
in thread How to create a new array with the same name as an existing one in a loop?
by MrSnrub
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |