develooper Front page | perl.perl6.language | Postings from July 2006

Re: sprintf and snake envy

Thread Previous | Thread Next
Larry Wall
July 4, 2006 09:37
Re: sprintf and snake envy
Message ID:
On Tue, Jul 04, 2006 at 05:27:33PM +0100, Nicholas Clark wrote:
: I'm not convinced that sprintf needs an operator. It's not commonly used in
: any code I've looked at, which to me suggests that it's not good huffman
: coding to use up a terse symbol for it, denying that symbol to something
: else.

Well, we kinda do have an operator already, if you consider infix:<as> to
be a variant of .as().

    $c as '%03d'

but it's arguable which is better in a string:

    $a = "{$c as '%03d'}"
    $a = "$'%03d')"

But that's backwards from Python's % operator.  Actually, I think I like
the Perl way better for single patterns...  :)


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