in reply to need help with array

The foreach loop aliases each element of the array to a loop variable for each iteration. If you don't include a loop variable explicitly, perl uses $_ by default.

The problem with your original code is that each iteration of the loop replaces the contents of your @wordlwr array with the current contents of $_ instead of appending $_ to the array as you expect. I think that the following code is what you want.

use strict; my @words = qw/ONE TWO THREE/; my @wordlwr = (); foreach (@words) { push @wordlwr, lc($_); } foreach (@wordlwr) { print "$_\n"; }