in reply to hash or arrays
push @{ $file_hash->{$dir} }, $file_name;
The arrays that $file_name are pushed into will be created automagically by Perl.Then to create the report:
foreach my $file_dir (sort keys %{$file_hash}) { foreach my $file (@{ $file_hash->{$file_dir} }){ print "$counter Directory: $file_dir $file\n"; $counter++; } }
|
|---|