Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: Hashes, File sizes, Translations, OH MY!

by SciDude (Friar)
on May 30, 2004 at 01:39 UTC ( #357543=note: print w/ replies, xml ) Need Help??

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


Comment on Re: Hashes, File sizes, Translations, OH MY!
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://357543]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2015-11-26 07:13 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (696 votes), past polls