in reply to Blankety-Blank Blanks and Zeros, etc.

Attempt 1 printf("A float: %12" . ($root_beer ? ".4f" : "s") . $/, ($root_beer || '')); blech.

Attempt 2

if ($root_beer) { printf("A float: %12.4f$/", $root_beer); } else { printf("A float: %12s$/", ''); }
Better, I think.

Attempt 3 printf("A float: %12s$/", $root_beer ? sprintf("%12.4f",$root_beer) : ''); Hmmm - I don't think so.

Attempt 4

my $root_beer_str = $root_beer || ''; # change 0 to blank. $root_beer_str &&= sprintf("%12.4f", $root_beer); printf("A float: %12s$/", $root_beer_str);
That seems mildly evil. I'm sure we could golf that down a bit... ;-)

Attempt 5 - just because. printf("A float: %12s$/", ($root_beer || '') && sprintf("%12.4f", $root_beer)); Ewwwww.... :-)