First, the "easy" part: mapping human languages with their ANSI abbreviation.
%language = (English => 'en', German => 'de', French => 'fr');
Next, to output them in alphabetical order:
foreach my $key (sort {$a cmp $b} keys %language) { print "$key has '$language{$key}' as the ANSI value\n"; }
Lastly, you could implement the output that you want in a couple of different ways. The first is store all of the file information in a hash of arrays, indexed by ANSI language code. Then, in the foreach loop that I have above, you'd do a hash lookup and process the contents of the array that lives there. This has the disadvantage of having to store all of the information for all files in memory before you output. The second method that I can think of is to alter your find subroutine to search for files of a specific language. You'd call it in your foreach loop. The disadvantage here is that you walk your file tree once for every language. I'm sure that there are other ways to do it, though.

thor


In reply to Re: Hashes, File sizes, Translations, OH MY! by thor
in thread Hashes, File sizes, Translations, OH MY! by hacker

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.