in reply to Re: Filling a matrix
in thread Filling a matrix
Does Perl even support a hash 4 levels deep? What is the limit on that anyway?
Since multilevel hashes are really just hashes holding references to other (anonymous) hashes, I don't think there is any real limit. Try e.g. the following:
#!/usr/bin/perl use strict; use warnings; use feature qw/say/; use Data::Dumper; my %hash = (); my $hashref = \%hash; for(1..255) { $hashref = $hashref->{$_} = {}; } print Dumper \%hash;
This works like a charm and as expected.
Bisecting this, I found I can go up to 4028 layers of indirection before Perl segfaults at 4029. (And 4028 produces 178 MiB of output from Data::Dumper.)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Filling a matrix
by Anonymous Monk on Aug 09, 2014 at 19:28 UTC | |
by AppleFritter (Vicar) on Aug 09, 2014 at 23:20 UTC |