Hi, I have just begun to use Perl for CGI programming. I have a situation where I run a command on the server through my perl script and try to retrieve the result of the command into a perl variable and then I try to display it on the web page:
my $var = `property <dataid>`; print "<td align="middle">$var</td>";
This command (property) sometimes produces an output of size almost 0.5Mb to 1Mb for some values of <dataid>(I checked the size of the output by executing the "property" command on the web server CLI).
I have 2 problems in capturing this output in the perl variable:
1] Only part of the output of the command is captured in the variable when the output is large (i.e, when output size is greater than 0.1Mb). How should I take care of this? Is there any feature in Perl to capture very large output?
2] The other problem is that the output of the command has some XML in it and when I capture it in the perl variable, the XML part is lost (From the example below, all text between and including <List> and </List> don't appear in the variable). How should one capture such data since its not completely XML? Should I be using any PERL/XML functions?
Sample output: Data <dataid> is not empty Content has xxx entires: ------ similar text ------- ------ similar text ------- <List> <List1>123</List1> <List2>345</List2> ------------------ ------------------ <Listn>23</Listn> </List> Loc has 40 files: filename-1 filename-2 ---------- ---------- filename-40
Any help is greatly appreciated. Thanks, Vinay

In reply to How do I capture large output in a perl variable by vsmurthy

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.