Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Multidimensional arrays within arrays

by reaper9187 (Scribe)
on Jan 23, 2013 at 20:37 UTC ( #1015019=note: print w/ replies, xml ) Need Help??


in reply to Multidimensional arrays within arrays

Ok .. so here is the part i feel ,if resolved will completely solve my problem .

@a = qw/Mon Tue Wed Thurs/; foreach $key(@a) { push(@$key, $key); print Dumper(\@$key); }
The only problem with the above code is the array variable. Now there occur three possibilities
#Declare array as push(@$key, #some values); .. .. #The above code will help me to generate different arrays for multiple + variables but it does not help me to create a multi-dimensional arra +y( Note: I cannot use an anonymous array here since i need to reitera +te the entire loop over several days to measure performance and i cou +ldnt find a way of pushing elements on to an anonymous array without +creating a separate reference for it) 2. #Declare array as push(@{$key[0]}, #some values); .. .. #Alhtough this will help me to get the desired array format , however +the most irritating part is that the variable $key is constant ,i.e e +vn if i iterate it over a loop, only one array ( i.e @key is generate +d and the reference for all the arrays is the same)
So, basically i am looking to create multiple arrays with the required references( multiple dimensions ,eg 2D).. Please help ..!!! I'm getting desperate now


Comment on Re: Multidimensional arrays within arrays
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2014-10-02 11:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    What is your favourite meta-syntactic variable name?














    Results (55 votes), past polls