Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Hash of a nArray and all that comes with it.

by moritz (Cardinal)
on Jul 28, 2012 at 05:43 UTC ( #984149=note: print w/ replies, xml ) Need Help??


in reply to Hash of a nArray and all that comes with it.

%entry = {$item_id=>\@data, $item_id=>\@data.....etc}

I hope that's not what you're doing, because that assigns a hash reference to a hash without dereferencing.

As long as I give an explicit value for $j's range, the output is fine. But I cannot figure out how to access the arraysize for $entry[$i]
my $len = scalar @{ $entry{$key}[$i] }

gives you the length of the $i array stored at $key.

And I think you're missing the part of your code where you assign to @entry, I can't see how you'll get any output like this. @entry = @{ $entry{$key} } should fix it.


Comment on Re: Hash of a nArray and all that comes with it.
Select or Download Code
Replies are listed 'Best First'.
Re^2: Hash of a nArray and all that comes with it.
by kingram (Acolyte) on Jul 29, 2012 at 00:53 UTC
    This is how %entry is being populated in the foreach loop:
    @update = ($id, $title, $foo, $bar, $baz); $entry{$file_num} = \@update;

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2015-07-30 03:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls