in reply to chomp not working in array

map { s/(?:^\s+|\s+$)//g; print "$_\n"; } @phrase;
Don't forget he wanted the lines printed too, and since you don't need the found values returned, you can add a ?: flag at the start.