Ok. Basically, somehow or another, I have an array called @sessions. This array carries three or four elements, with each element look like this:
Port User            Host/Inet/Dest   Type    Dir Status         Start   Idle
---- --------------- ---------------- ------- --- ------------- ------ ------
C0   -               -                Login   In  USERNAME           0      0
S0   aaaaaa          aaaaa            Netwrk  In  ESTABLISHED     4:08      5
S1   bbbbbb          bbbbb            Netwrk  In  ESTABLISHED     1:01      1
S2   -               -                Log/Net In  IDLE               0      0

And so on. Say the above is $sessions1. What I need to do is split $sessions1 on the newline, and then split the results of that by the columns above.

And I need to do this for each element of the array, in one big glorified loop which basically allows me to take the pretty plain text thing up there, munge it with another array of plain text thing, and spit it all out in beautiful HTML. Make sense?

(Note: I've tried playing around with getting each newline into a separate array element - I've pulled my hair out trying. Perhaps you could solve that too <g>... I'm using Net::Telnet to telnet to a terminal server, issue a command, press return 3 times, and suck all the information into an array. No matter how much I try though, I can either get all the information plopped into three array elements in the form above, or only the first screen of information plopped into individual array elements.)


In reply to Looping through a split() and more... by morbus

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.