in reply to appending multiple values in an array
To prevent overwriting you should declare the new array outside the loop:my @array = (1,2,3,4,5); foreach my $line (@array) { my @newarray; push (@newarray, $line); print @newarray; }
Of course, you could be doing something entirely different - so difficult to know without seeing the code...my @array = (1,2,3,4,5); my @newarray; foreach my $line (@array) { push (@newarray, $line); } print @newarray;
|
---|