in reply to simple question

It prints on multiple lines becaue the data you get from `data -u etc` contains a new line at the end. That is why
print "the year is $yr"; print "the month is $mm";
appears on different lines in the output, both $yr and $mm have a new line at the end. If you want to get rid of the new line, try chomp.