in reply to Hashes, File sizes, Translations, OH MY!
You are very close to a solution. Do your filenames already have the "_es", "_en", etc. attached to them? If so, a simple matching operator comparision should allow you to organize them:
if ($basename_v =~ m/_en/) { @english = ($basename, $size, $date) }
Repeat this for each language and print each array out in any order you wish. If you have multiple filenames per language just keep pushing them onto the array. If you really must place everything in one structure - only then consider a hash of arrays,
%Files = ( english => ["file1", "size1", "date1"], spanish => ["file2", "size2", "date2"], );
Printing these should be straightforward:
for $language ( keys @Files ) { print "$language: @{ $Files{$language} }\n"; }
Hash output can also be sorted if you wish.
Note: untested code
|
---|