foreach (@dates) { s|^\s+||; #remove leading space s|\s+$||; #remove trailing space s|\s|/09 |; #add the year s|-|/|; #change - to / ... }