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

A possible solution for s?pintf

Thread Next
From:
Juerd
Date:
March 12, 2005 14:57
Subject:
A possible solution for s?pintf
Message ID:
20050312225739.GR30120@c4.convolution.nl
Without introduction, I'll just present the syntax idea:

    f/%03d %15s/$foo, $bar/;

This gives s?printf to any expression with short and concise syntax,
making printf redundant, which means I won't even have to start a
discussion about sayf :)

    printf "%03d %15s", $foo, $bar;

vs

    print f/%03d %15s/$foo, $bar/;

Of course, this is s///-like in quoting behaviour, so f[][] or f"""
should work just as well. The RHS is not a string, but parsed as an
expression in list context. If this feels weird, just think of s///e,
where the RHS is also not a string.


Juerd
-- 
http://convolution.nl/maak_juerd_blij.html
http://convolution.nl/make_juerd_happy.html 
http://convolution.nl/gajigu_juerd_n.html

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About