I'm going to take you at your word, even if it isn't what you meant.

The algorithm is then:

  1. Open the file
  2. Read a line
  3. Split on commas
  4. Push the 3rd field onto an array
  5. Append the second and first fields to a string, space delimited
  6. Go to 2 unless at EOF
  7. Print the unique array values followed by the string

Which bits in particular of this algorithm would you have problems with when converting into real Perl code?

Update: While writing this reply, all content was removed from the OP.

Update 2: Thanks to GrandFather restoring the original content and now with the code tags it's a little clearer what bishop2001 wants. So, here's a slightly revised algorithm:

  1. Open the file
  2. Read a line
  3. Split on commas
  4. Push the 3rd field onto an array
  5. Concatenate the second and first fields into a string, space delimited
  6. Push that string onto the arrayref value of a hash keyed on the 3rd field
  7. Go to 2 unless at EOF
  8. Print the unique array values.
  9. Loop while there are still data items in one of the HoA fields and print the nth entry in each.

The question remains: which bits in particular of this algorithm would you have problems with when converting into real Perl code?


In reply to Re: format file by hippo
in thread format file by bishop2001

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.