While I suspect there is some more pragmatic answer, you might get that kind of behaviour from passing an overloaded object to the code (f ex something that overloads stringifying and concatenation and makes a poor job at it), or some tied variable, I guess. What are you passing to this sub, anyway? (Obscure reference: It is not $2, is it?)

Unless you are passing something you know to be strange magic, I would have another look at how this passed value behaves. Like this, perhaps:

my $passed_sql = shift; my $sql = "SELECT COUNT(*) etc blah blah"; print STDERR "Trying[1] to print parameter alone: " print STDERR $passed_sql; print STDERR "\nTrying[2] list print: ", $passed_sql; print STDERR "\nTrying[3] interpolated: $passed_sql\n"; die if $sql ne $passed_sql; # Might as well ... my ($total_cols) = $dbh->selectrow_array($sql) or die($dbh->errstr +);

Again, I expect the problem is easier (and might be fixed alread?), but if not, I hope this helps.

The Sidhekin
print "Just another Perl ${\(trickster and hacker)},"


In reply to Re: Re: Re: when is a string not a string? by Sidhekin
in thread when is a string not a string? by purge

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.