Could you be more specific what you want the output to look like? Also, how would the code know when to break apart the input - is it just each "X1" marker that the code encounters, or is it something else like "BEGIN_TAG"? To put that a different way, what should the output for this input look like? (How do I post a question effectively?)

BEGIN_TAG X1 a b c d X1 e f g h BEGIN_TAG X1 i j k l X1 m n o p

As for the data structure, as one possibility I'd suggest you have a look at "Hashes of Arrays" in perldsc.

Update: For CSV input and output, I'd very strongly recommend Text::CSV.


In reply to Re: Returning an array in a specific way for csv by haukex
in thread Returning an array in a specific way for csv by Arengin

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.