in reply to formatting output

Check out the format function, very powerful...
perldoc -f format