This is neat! Now, for a explanation of this code:

  • Remove all whitespace from the string $cow
    $cow =~ s/\s//g;
  • Remove all characters in $cow which are not x or Y. Bind $cells to the number of removals performed (which turns out to be 100)
    $cells = ($cow =~ s/[^xY]//g);
  • The next line has two maps.
    1. The first map operates on a list of 3 strings in which each string only contains a series of "x"s. Thus the tr command in the map is used to return the number of "x"s in each string it is fed. Ths resultant list is (9,11,11).
    2. The next map adds $cells (which is 100) to each of these numbers and prints the ascii value of these numbers, which prints out moo

      PRINCE "too bad user settings doesnt let me preview this" PAWN


      In reply to RE: holy cow by princepawn
      in thread holy cow by agoth

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



    3. Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
    4. Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
    5. Read Where should I post X? if you're not absolutely sure you're posting in the right place.
    6. Please read these before you post! —
    7. 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
    8. 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;
    9. Link using PerlMonks shortcuts! What shortcuts can I use for linking?
    10. See Writeup Formatting Tips and other pages linked from there for more info.