in reply to Pushing Data into a Hash
One key thing that I think you are doing incorrectly is you are clearing the contents of @rangelist after you store a reference to it in the hash. In the end, each hash value will be a reference pointing to the exact same array, which will probably be empty.
@rangelist = (); #just keeps dumping the data stored there.
Change @rangelist into $rangelist and make it a reference to an anonymous array. Then when you need another array, you just declare another one and assign it to $rangelist.
Like so:
unless($_ =~ /^\d+\.\d+\.\d+\.\d+/) { unless ($key eq "") { $CoreRegR{$key} = $rangelist; } $rangelist = []; $key = $_; } else { push(@$rangelist,$_); }
HTH
P.S. Check out the standard Data::Dumper module to print out complex data structures so you can more easily see what is being built.
|
|---|