develooper Front page | perl.perl6.language | Postings from March 2005

Re: A possible solution for s?pintf

Thread Previous | Thread Next
March 12, 2005 15:58
Re: A possible solution for s?pintf
Message ID:
Brent 'Dax' Royal-Gordon skribis 2005-03-12 15:51 (-0800):
> Besides, I think "as" will do just fine, especially since you can now
> interpolate method calls as well.  You can even do something like this
> if you want to perform bulk formatting:
>     say join ' ', ($n1, $n2, $n3) >>.as('%d');
> Or, if that's not quite sufficient:
>     say map { }
>         $num => '%d',
>         $str => '%s',
>         ...;

I'm really getting the feeling I'm the only one who uses sprintf because
it *separates* and lets you write complex things on one simple line.
That, and I use it a lot in one liners.

Writing complex things as complex things feels weird.

I know there are alternatives, and they're good. I can certainly see how
.as can come in handy. But sprintf (or call it "format", which I do like
better than the unpronounceable "sprintf") as a semi-list operator is
very useful too. I just don't like the amount of typing (with the nested
delimiters: parens and quotes) it requires.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About