in reply to Return variable hangs script

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

That doesn't assign a reference to an array, it puts the length of the array @array into $count What you want (and are probably doing in your real code) is

$count = \@array;

Other than that, I'd start by inspecting the value that actually ends up in $count to see what it contains. You can use the inbuilt ref function or Scalar::Util->reftype(). Also consider posting the real code you're using (since you've obviously made at least one mistake in transcribing/summarising it), it sould be particularly pertinent to know which "external module" returns the array reference.


All dogma is stupid.

Replies are listed 'Best First'.
Re^2: Return variable hangs script
by joedoc (Initiate) on Jul 03, 2007 at 14:04 UTC
    You misunderstood. I'm not trying to assign the array to a ref. I already have a ref. The array is just a place holder to take elements from the original array ref so we can string them together. (See my more extended code in the first response above).

    What I'm doing with $count = @array is just get a count of the elements in @array after we stick them in there. That's what I want.

    And I've examined $count and it equals n, the number of elements, which is exactly what I want. A number.