The following is what I ended up doing. Part of the problem here was that I didn't know exactly what the data was (maintaining someone else's 12k lines of perl w/ almost no comments is a b****) and I still don't know where some of it is coming from. Any suggestions for improvement would be appreciated.
The data was arranged:
%::Volume_Info = {
0,
512,
1048576,
1,
%spindles = {
0 => ARRAY
1 => ARRAY
2 => ARRAY
3 => ARRAY
},
[ ARRAY ],
%copy_pool = {
0 => [ ARRAY, 0, 0, 1]
},
-1,
0,
0,
0,
}
for my $vol_key ( keys %::Volume_Info ) {
print "Volume " . ref($::Volume_Info{$vol_key}) . "\n";
foreach my $item ( $::Volume_Info{$vol_key} ) {
if (ref($item) eq "ARRAY") {
foreach my $item2 (@$item) {
if (ref($item2) eq "ARRAY") {
foreach my $ar_el (@$item2) {
print "array_element: @$ar_el\n";
}
} elsif (ref($item2) eq "HASH") {
foreach my $hash_key (keys %$item2){
print "\t hash key: $hash_key\n";
if (ref($$item2{$hash_key}) eq "ARRAY") {
foreach my $item3 ($$item2{$hash_key})
+ {
# if (ref($item3) eq "ARRAY") {
# foreach my $an_el (@$item3) {
# print "\t\t\tanother elem
+ent @$an_el\n";
# }
# } else {
print "\t\tspindle values: @$i
+tem3\n";
#}
}
}
}
} else {
print "Array Item: $item2 \n";
}
}
}
}
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.