in reply to Shift returning pointer

Your shift looks fine, my guess is that the problem is at the point where $Envs->{data} is assigned. Can we see that code, please?

Replies are listed 'Best First'.
Re^2: Shift returning pointer
by rgb96 (Acolyte) on Mar 16, 2009 at 18:09 UTC

    Thanks guys, that makes sense to a degree. I'm not sure why it changes to array refs though. Here is my code where I am assigning what is in the list.

    open(ENVIRONMENTS, "environments.txt"); while(<ENVIRONMENTS>){ my $line = $_; chomp($line); push @{$Envs->{data}}, [$line];
      The square brackets around $line put it into an array ref before pushing it onto @{$Envs->{data}}. Drop them, and it'll work the way you want:
      push @{$Envs->{data}}, $line;

        Okay, I figured out where my problem is. here it is.

        push @{$EnvsToRun->{data}}, [$environment, $duration, $config];

        When I try to add it to a list with 3 columns, I get the array ref, but if I take the square brackets off, I get three separate entries, with the variable argument in the first column of each entry with they other two as 0s. If I use the brackets, I get the array ref, and then the other two columns are fine. I've tried a few combos of parantheses and brackets, but the brackets seem to be the only things that matter.