in reply to Adding Array References to an Array

use strict and declare your variables. Because @tfl_contents never goes out of scope, you are reusing the same array over and over again, and simply pushing a new reference to the same array into @target_file each time.


We're not surrounded, we're in a target-rich environment!
  • Comment on Re: Adding Array References to an Array

Replies are listed 'Best First'.
Re^2: Adding Array References to an Array
by pKai (Priest) on Dec 29, 2006 at 09:05 UTC

    Good catch.

    You might have mentioned to the OP, that the/a/one remedy in this situation is to construct a new reference on every push, as in

    push(@target_file, [@tfl_contents]);