Am I correct in saying that this perhaps is because the object I m trying to print to string is not the correct type?
No, its because you don't have an object, observe
#!/usr/bin/perl -- use strict; use warnings; use diagnostics; use CGI(); my $cgi = CGI->new(); my $poop = []; $cgi->header; $poop->nonsense; __END__ Can't call method "nonsense" on unblessed reference at temp.pl line 13 + (#1) (F) A method call must know in what package it's supposed to run. + It ordinarily finds this out from the object reference you supply, bu +t you didn't supply an object reference in this case. A reference isn't + an object reference until it has been blessed. See perlobj. Uncaught exception from user code: Can't call method "nonsense" on unblessed reference at temp.pl + line 13. at temp.pl line 13
If you don't know what you have, you can use Data::Dumper to find out, example
#!/usr/bin/perl -- use strict; use warnings; use diagnostics; use CGI(); my $cgi = CGI->new(); my $poop = []; use Data::Dumper; print Dumper( $cgi, $poop ); __END__ $VAR1 = bless( { '.parameters' => [], 'use_tempfile' => 1, '.charset' => 'ISO-8859-1', '.fieldnames' => {}, 'param' => {}, 'escape' => 1 }, 'CGI' ); $VAR2 = [];

In reply to Re: unblessed reference by Anonymous Monk
in thread unblessed reference by carterniall

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.