in reply to Extra spaces

Also, make sure you understand in the examples here that the substitution is being done on $_. You can do something like foreach (@lines){s/whatever/whatever/} and the $_ variable will be set to your list.

Time flies like an arrow, fruit flies like banannas