I'm confused by your question. If you're using the function oriented interface (and you appear to be), instantiating a CGI object is useless. Try this:

use CGI qw/:standard/; # vvv note the equals sign my $html = p($font_o,'---[', b('Handle: '),$gbdata->{'handle'},br(),'----[', b('Email: '),$gbdata->{'email'},br(),'-----[', b('Website: '),$gbdata->{'url'},br(),'------[', b('IP: '),remote_host(),':',server_port(), br(),'-------[', b('Browser: '),user_agent(),br(),'--------[', b('Date & Time: '),$time, br(),br(),'[', b('Message'),']',br(), hr(),$gbdata->{'comments'},br(),hr(),'</font>',), end_html(); unshift (@contents, $header, $html);

That's what I think you mean. If you want to know how to assign separate HTML elements to an array, one way to do it is to use CGI::Pretty and split on the newlines.

use strict; use CGI::Pretty qw/:standard/; use Data::Dumper; my @contents = split /\n/, b('<font face="arial">','---[', b('Handle: '),'Ovid',br(),'----[', b('Email: '),'ovid@ovidinexile.com',br(),'-----[', b('Website: '),'http://www.ovidinexile.com/',br(),'------[', b('IP: '),remote_host(),':',server_port(), br(),'-------[', b('Date & Time: '),scalar localtime, br(),br(),'[', b('Message'),']',br(), hr(),'Comments, anyone?',br(),hr(),'</font>',), end_html(); print Dumper \@contents;

The second answer isn't perfect, but I don't think it was what you were looking for, anyway :)

Cheers,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.


In reply to (Ovid) Re: Assigning CGI object data by Ovid
in thread Assigning CGI object data by s0ttle

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.