Hello monks, I have an array and i want to extract each element of that array and insert into the database. The problem is that database is only of 3 fields and after inserting the second element it should be able to insert the data on the next line. Here is the array data. They are separated by a | and the other problem is that many of the values does not have a 3rd field. From all these only the DG306AE25 has a 3rd field which is D0027667. Please help me
CB5021|Unitrode Corp|CB5022|Unitrode Corp|CB5023|Unitrode Corp|CD5000| +Unitrode Corp|CD5001|Unitrode Corp|CD5002|Unitrode Corp|CD5003|Unitro +de Corp|DG224SE08|Marconi Circuit Technology Inc|DG224SE10|Marconi Ci +rcuit Technology Inc|DG224SE12|Marconi Circuit Technology Inc|DG304SE +08|Marconi Circuit Technology Inc|DG304SE08|GEC Plessey Semiconductor +s|DG304SE10|Marconi Circuit Technology Inc|DG304SE10|GEC Plessey Semi +conductors|DG304SE12|Marconi Circuit Technology Inc|DG304SE12|GEC Ple +ssey Semiconductors|DG306AE25|Zarlink Semiconductor||DG306AE25|GEC Pl +essey Semiconductors|D0027667|DG306SE18|Marconi Circuit Technology In +c|DG306SE18|GEC Plessey Semiconductors|DG306SE19|Marconi Circuit Tech +nology Inc|DG306SE19|GEC Plessey Semiconductors|DG306SE21|Marconi Cir +cuit Technology Inc|DG306SE21|GEC Plessey Semiconductors|DG306SE23|Ma +rconi Circuit Technology Inc||

In reply to Extract Elements from an array and insert into database by parshtml

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.