Where you are reading the data (the while ! eof section is probably where you want to do this. Instead of the print command, you would load it into a buffer for processing it into a hash.

The way that you are reading the text from $bigcmd will not give you data in any structured form, but just as a string of at most 1024 characters at a time. You will probably want to join the strings together, split them into the actual records (or use regular expressions), and then push them into a data structure.

One thing that may help get some more help on this is to list a small snippet of what the output looks like, as well as how the resulting output string should look.

Update: As zentara has also stated, if you are just looking to have a set of lines, and not structured data, reading the data into an array is likely a better option.

--MidLifeXis


In reply to Re: redirect stdout into hash by MidLifeXis
in thread redirect stdout into hash by doctorspears

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.