in reply to Strange problem with nested arrays and scoping.

You've got yourself into a nasty tangle with reference and sigil syntax. See References quick reference by tye for a review. I can't tell whether you are trying to push a single element or an array, but push( @{$holder[$sheet][$iC]}, $data[$sheet][$iC][$index]); seems a likely interpretation of what you want.

After Compline,
Zaxo

Replies are listed 'Best First'.
Re: Re: Strange problem with nested arrays and scoping.
by Tyr_7BE (Initiate) on Dec 02, 2003 at 21:18 UTC
    Very true. Thank you for the tip. I've cleaned up my code (throughout the entire script), and it's now considerably less gory to read.

    However, the problem persists :(

    print "Pushing ".$data[$sheet][$iC][$index]." onto holder[$sheet][$iC] +\n\n\n"; push(@{$holder[$sheet][$iC]}, $data[$sheet][$iC][$index]); print "holder[$sheet][$iC] = ".$holder[$sheet][$iC]."\n";
    Yields
    Pushing 1-Jun-97 onto holder[0][3] holder[0][3] = TTY9.3

    Other notes:
    @holder is initalized with "my @holder". $holder[$sheet] is initialized with "$holder[$sheet] = ('');" (so that I can reference it in array context and push values.

    Anyone know what else may be happening?

      Erm, $holder[$sheet][$iC] ought to print as something like "ARRAY(0x8106164)" since the push makes it an array reference. Is there more to this than you've shown?

      After Compline,
      Zaxo