A few days ago, one of the Perl Maven readers asked me about indexing in arrays in Perl, and then he was wondering if arrays that only have elements in some high index are sparse arrays? In other words if we have an array with a single value at index 1,000,000 does Perl allocate space for all the preceding 1,000,000 elements, or is does it take up place for the single element in the array.
In yet other words, how much memory does this use?
my @a; $a[1_000_000] = 1;
Perl Maven Pro - screencasts with articles
As a Perl Maven Pro subscriber you will enjoy a growing library of articles and screencasts.
Two screencasts a week and all the previous screencasts!
Ad free browsing!
The articles contain topics such as Web Application Development, Object Oriented programming, testing, deployment, code walkthroughs, best practices, and many more subjects in Perl, and in related technologies.
Subscriptions include all previous pro episodes.
If you already have Perl Maven Pro subscription, you will need to login to access the articles.