http://www.perlmonks.org?node_id=960354


in reply to store multiple files in multidimensional array

If you're globbing as in @filesList = <*> or @filesList = glob "*", consider what the order of the files would be in the array. You may want it sorted:
bash-3.2$ cat d1 abc cde edf bash-3.2$ cat d2 rst tuv uvw bash-3.2$ cat d3 ghi hij jkl bash-3.2$ cat t4.pl my %data; while (<>) { chomp; push @{ $data{$ARGV} }, $_; } my @sorted_data = map $data{$_}, sort keys %data; use Data::Dumper; warn Dumper \@sorted_data; bash-3.2$ t4.pl * $VAR1 = [ [ 'abc', 'cde', 'edf' ], [ 'rst', 'tuv', 'uvw' ], [ 'ghi', 'hij', 'jkl' ] ];