Ok, I'm going to try and keep this short. I humbly ask for the wisdom of my brethren to help expound upon my limited knowledge. I have a situation where I'm pulling statistics off of some systems that will have anywhere from 4 to 16 drives (mirrored). These are proprietary systems that only allow telnet access so I'm using the Expect module for perl to interact with these things. One of the stats I'm collecting involves the number of drives and type of drive, through an elongated process I send a command to get the number of drives and here's a snippet of the output.
voice_drives number:14 drive00 state: in_service drive01 state: in_service ....
I then send a "devstat vd0" and it returns
DEVICE vd0 physunit 0x0 Inquiry: SEAGATE ST34573N ....
and so on for each drive. I can easily grab the number of drives, status and the Make/Model, however here's my quandry. I would like to put this data along with other stats into a MySQL DB. How can I construct an insert statement (using the DBI) to insert 4 drives for one unit, 8 drives for another and 14 for yet another without hardcoding some sort of if..then..else conditional to control it? Any wisdom imparted would be greatly appreciated.

In reply to How many drives does it have? by TeKk9

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.