in reply to Formatting an output with printf

You should never (well almost) write

function( "$var")
You should use simply
function( $var)

If you use the "$var" you are forcing Perl to convert the value of $var to a string and create a copy. This is usualy just a waste of time and memory, but sometimes it actualy breaks the code. If the $var is a reference (or an object ... which is actually also a reference) then Perl creates a string that looks like SCALAR(0x1a4b680). But there is no way to convert this back to a reference. So instead of passing the reference or object you pass a completely useless string.

Jenda
Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live.
   -- Rick Osborne

Edit by castaway: Closed small tag in signature