Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: unknown number of dimensions of a multidimensional hash

by Anonymous Monk
on Mar 10, 2006 at 00:47 UTC ( #535575=note: print w/replies, xml ) Need Help??

in reply to unknown number of dimensions of a multidimensional hash

If the hash is not ragged, you simply know its dimensionality. If you somehow lose this information

sub hashfirst { $_[0]->{($_) = keys %{$_[0]}} } sub shape { my $h = shift; my @s; for (;'HASH' ne ref $h; $h = hashfirst($h)) { push @s, scalar(keys %$h); } @s }

may help you remember. This feels like an X-Y question.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://535575]
[Corion]: So now there will be the fun of me explaining to the project that $other_project had low priority because $project has high priority. If $project picks up the task from $other_project, they also will need to reprioritize my tasks to get that done...
[Corion]: ... of course at the cost of something else on my list of tasks for $project, as there only is a finite amount of days until $deadline.

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (6)
As of 2017-08-17 12:24 GMT
Find Nodes?
    Voting Booth?
    Who is your favorite scientist and why?

    Results (287 votes). Check out past polls.