in reply to references--hard vs anonymous operational weirdness

Gentle folks,

Thanks for your prompt and interesting attention. However, the array in question is defined inside the loop. A bit more of the code would certainly help the explanation.

opendir THISDIR, "."; while ($file = readdir THISDIR) { if ($file =~ /csv$/i) { open(INPUT, "$file") or die "Could not open $file. \n"; @array = <INPUT>; ($tab) = ($file =~ /.*\.(T\w+)\./); # Separate tab number from +file name $data{$tab} = [@array]; close INPUT; } }

This one seems to work. With the \@array structure each array is correct when established but is over written the next time through the loop. Ideas??

Many thanks.

Replies are listed 'Best First'.
Re^2: references--hard vs anonymous operational weirdness
by ysth (Canon) on Mar 23, 2008 at 07:47 UTC
      The perl-o-sphere has increased by some quantum amount.

      Somehow during the past couple of years fooling with perl, I missed that aspect of variable scoping. This points me back into that subject for further exploration.

      Many thanks for the answer and insight to this query.