I have used the following statements to get the current time.
print \"$query executed successfully at \",localtime; print \"$query executed successfully
scalar forces scalar context:
print scalar localtime ();
In the second example, it's clearly a list context so you're just getting a printout of the numbers in a row. For example, try
print join (":", (localtime));
and you'll see the numbers joined with a colon.