in reply to Re: Blankety-Blank Blanks and Zeros, etc.
in thread Blankety-Blank Blanks and Zeros, etc.
Why not just switch out the format?
That's what I'd do if I didn't care too much about maintainability.printf +($root_beer ? "%12.4f" : " "x12)."\n", $root_beer;
Of course, the correct way to do it is something like this:
Or any way that you consider more readable. Where "readable" means that you can look at it 6 months later without thinking, "what the hell was I thinking when I wrote this?" :-)if ($root_beer) { printf "%12.4f\n", $root_beer } else { print " "x12 . "\n"; }
|
|---|