Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

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

SciDude


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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2014-10-22 21:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (122 votes), past polls