So I looked at the C# code and I have a few comments.

 .Select(x => x.Split(new char[] {'.'})) is better written as  .Select(x => x.Split('.')). No need to explicitly construct the array unless you have to pass the count or split options.

There's no point in splitting the version and then joining it back. Just keep it. Same way as if you used the Schwartzian transform in Perl. The code has to be somewhat more talkative, in part because the IEnumerable (aka list) transformations (.Select() aka map{}, .Where() aka grep{} and so forth) are kinda lazy and sometimes you have to make sure they are applied and the result remembered. And you have to choose the data structure used to remember them.

This is how I would write the code:

var sortedPerlVersions = perlVersions .Select(x => new { full = x, parts = x.Split('.').Select(n => Conv +ert.ToInt32(n)).ToArray() }) .OrderBy(x => x.parts[0]).ThenBy(x => x.parts[1]).ThenBy(x => x.pa +rts[2]) .Select(x => x.full) .ToList();

You do not have to specify all those types. List<int> nameLengths = new List<int>(); is equivalent to var nameLengths = new List<int>(); and it's shorter and easier to modify.

Same with things like foreach (string perlName in Perls.Keys)

Jenda
Enoch was right!
Enjoy the last years of Rome.


In reply to Re: berrybrew, the perlbrew for Windows, updated to v1.18 by Jenda
in thread berrybrew, the perlbrew for Windows, updated to v1.18 by stevieb

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.