in reply to need help with array
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"; }
|
|---|