in reply to A quick date swap from a string

Do you use warnings;? When I add that to your code, it shows that you use my $date twice in the same context.

Update: Showing how you call your function would be helpful, too.