Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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

by holli (Abbot)
on Aug 15, 2021 at 18:11 UTC ( [id://11135860]=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?

Ideally you create the array where it is supposed to stay (remember autovivification).
>perl -MData::Dumper -e "my %hash; push @{ $hash{array} }, 1; push @{ +$hash{array} }, 2; print Dumper \%hash;" $VAR1 = { 'array' => [ 1, 2 ] };


holli

You can lead your users to water, but alas, you cannot drown them.
  • 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://11135860]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2024-04-19 13:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found