in reply to Newbies question: initializing data structure

What happens if you just start using the hash without initializing it? Most of the time, Perl does the right thing without complaint. If you add to a element that does not exists, Perl pretends it's zero and adds the number. If you push on a non-existent array, Perl creates it and pushes the value.

But if you insist on initializing the hash, use a simple loop:

#!/usr/bin/perl use strict; use warnings; my %hash = (); my $length = 10; for my $index ( 0 .. $length-1 ){ $hash{COUNTS}[$index] = 0; $hash{LISTS}[$index] = []; } print '%hash ', Dumper \%hash;