I think the best way to do that is to use perl's format capabilities.
In reply to Re: Visualisation of environment by cyocum in thread Visualisation of environment by AndreasL