in reply to appending multiple values in an array
Well, if you're sure that the result is being overwritten, then you have probably declared the array within the foreach loop:
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;
In Section
Seekers of Perl Wisdom