Monks:

I thought I posted this last night before our power went out...long story...

I'm working on a web application. In one script, I have a subroutine that creates three variables. One is an array ref created via an external module function call. The second is a long string of alpha-numeric strings extracted from that array ref, pushed to a temporary array and single-quoted and joined.

The third one is the problem: it's a very simple count of elements in the aforementioned temporary array. Like this:

$count = @array;

We have tested for the value of $count, and it's a number, just as one would expect.

We are trying to return the three variables to the caller in a later part of the script. We call thusly:

($aref, $count, $string) = MySub;

and we return from MySub:

return ($aref, $count, $string);

Basic. Problem is when we include $count, in any position, even alone, the script hangs. The debugging setup the client uses is primitive and basically useless, since it only returns debug and trail information to the web page...and if the web page hangs, we can't see what's happening.

When we remove that one variable, everything works fine.

We probably don't need to return this value, and we can find a workaround if necessary. But I had to wonder if anyone had experienced anything like this and had a clue as to why this might happen. It's a number.

This same application has plenty of functions that return all kinds of variables all over the place (since I wrote many of them), and everything else works peachy.

I appreciate any wisdom on this head-scratcher.

In reply to 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.