in reply to simple question

The output of the `date ...` contains the newline at the end. So when you print them, you print the newlines, too.

You could chomp each variable separately, or you could chomp them all at once, like this:

chomp ($yr,$mm,$dd,$yyyymmdd);