Yes, it's a normal array. We create it as a "placeholder" to build the longer string. The array ref contains array refs of strings from a database column, that look like this:

12345678-abcd-4321-wxyz-wufht83nwi03

They're all unique. We need to fetch all the strings, then quote them and string them together. That resulting long string is passed to a subsequent SQL query as an IN ('...') conditional.

Here's what I'm doing, in more detail:

my ($aref, $acount, @temparray, $tcount);

$aref = GetArrayRef($dbh,$sqlquery);

$acount = @$aref; # results in n

foreach (@$aref) { push(@temparray,qq('$_[0]') ); }

$tcount = @temparray; # should also equal n, and does.

After we create @temparray, we join all the elements to a string. We have to quote the strings or else Oracle will not parse the query correctly.

The problem is that when we return $tcount to the caller, it hangs. $acount passes fine.

I've double checked everything, including any called modules, and everything seems fine.

Odd.

In reply to Re^2: Return variable hangs script by joedoc
in thread Return variable hangs script by joedoc

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.