Update: Thanks to fglock for answering my question and getting me back to work!

I'm trying to use the larrd graphing tool to output a graph of data in an RRD. The larrd script contains this hash:
my(%graph_c) = ( SQLDB_Server => { hourly => { start_sec => "e-48h", title => "$host $titleDesc Last 48 Hours", }, yaxis => $yaxisDesc, lines => sub { my ($RRD,$service,$graph,$p,$color)=@_; $RRD =~ s/:/\\:/g; return [ qq{-u 5},qq{-l 0}, qq{DEF:stat1=$RRD:$table:AVERAGE}, ** qq{LINE2:stat1#0000FF:$lineName} ] }, }, );
It calls this hash on this line:
@defs = (@defs,@{&{$graph_c{$service}{'lines'}}($RRD,$service,$graph,$p++,&color() )});
With the above setup, the graph comes out fine. I would like to be able to dynamically add multiples of the line marked **. If I try to store the various qq'd strings into a variable, adding as many ** lines as I'd like, then return the variable, the script crashes in apache giving premature header errors.
I am unable to understand exactly what is being returned in the sub, and how to mimic it while returning a variable instead.

In reply to Difference in returning string "x" vs string "x" in a variable by Matt G

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.