in reply to confusing question, involving multidemensional arrays

To make a multi-dimensional array, you just make an array, who's elements are references to anonymous arrays.

$anon_array_ref = ['one', 'two', 'three']; @md_array = ( ['one', 'two', 'three'], ['four', 'five', 'six' ], # ...etc... ); print "Yep.\n" if($md_array[0][1] eq 'two'); my @data; for my $file (map "$_.dat", @cat) { open(my $fh, "< $file") or die "can't open $file: $!\n"; push @data, [<$fh>]; close $fh or die "can't close $file: $!\n"; } print $data[0][0];

You might be better off using a hash, keyed by the categories, for the "outter" "array". Same principle applies: make each value a reference to an anonymous array.

Update: Fixed bug, and make code more idiomatic. Use dragonchild's hash.

bbfu
Seasons don't fear The Reaper.
Nor do the wind, the sun, and the rain.
We can be like they are.

  • Comment on (bbfu) (multi-dim. array from files) Re: confusing question, involving multidemensional arrays
  • Download Code