![]() |
|
Pathologically Eclectic Rubbish Lister | |
PerlMonks |
Re: I don't use printf enoughby demerphq (Chancellor) |
on Oct 22, 2003 at 23:12 UTC ( #301419=note: print w/replies, xml ) | Need Help?? |
I find that I often end up converting simple concatenation or interpolating print statements into (s)printfs. Especially as they get larger and more cumbersome I find the template-arg list approach more convenient and easier to manage. A useful trick is things like this:
Or if you are using ternaries in the output or whatever. Unlike BrowserUK and others I find printf a lot easier to manage. Also heres a cute trick (that I will eventually release as a CPAN module with more features)
Possibly not the most persuasive example, but on a number of occasions ive used this to greatly simplify diagnostics output inside of loops. Unfortunately it doesnt play nicely with for(LIST) because the iterator var is aliased, and accordingly it isn't in the bound argument array.
---
demerphq First they ignore you, then they laugh at you, then they fight you, then you win.
In Section
Meditations
|
|