Thank you for attempting to post your code -- but this is not the code you are using. Please use a copy and paste function so we are getting the actual code you are using. There's no point in me debugging a typo on PerlMonks that isn't actually in your code.

Here's how I know this is not the code you are using:

C:\Steve\Dev\PerlMonks\P-2013-10-18@1712-DataMergeCSV>mergetest1.pl Global symbol "@array1" requires explicit package name at C:\Steve\Dev\PerlMonks\P-2013-10-18@1712-DataMergeCSV\mergetest1.p +l line 5. Global symbol "@array1" requires explicit package name at C:\Steve\Dev\PerlMonks\P-2013-10-18@1712-DataMergeCSV\mergetest1.p +l line 18. Bareword "abc" not allowed while "strict subs" in use at C:\Steve\Dev\PerlMonks\P-2013-10-18@1712-DataMergeCSV\mergetest1.p +l line 41. Execution of C:\Steve\Dev\PerlMonks\P-2013-10-18@1712-DataMergeCSV\mer +getest1.pl aborted due to compilation errors.

If you don't know how to resolve the errors listed above, ask about those. I would be glad to help you learn this stuff on any level. But I emphasize I will help. This means you have to be there, too.  :-)

Also, please post your input file (also using a copy and paste function, please), and put it in between

<readmore>
<code>
{your data here}
</code>
</readmore>

tags for easy downloading.

As noted by Laurent_R, what you posted gives us an idea of what your input data looks like, but it's not quite specific enough given that you ask to help format it exactly like the output you want. Can't get the exact output without the exact input.  :-)

Finally, once we have your core code working, we will examine the possibility of using the Text::CSVmodule or something similar, and we can cover how you make that happen at that time.

Let's crawl first, then walk, then run, then, perhaps, even fly.  :-)


In reply to Re^3: Combining multiple lines based on the given condition by marinersk
in thread Combining multiple lines based on the given condition by anony

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.