Hello!

Recently I was coding Perl 5 and quite often I had to change
interpolated strings or C<print> to C<sprintf> or <printf>.

I began to wonder, if qq strings couldn't allow sprintf-like
formatting directly.

I could imagine an \F escape sequence with the following syntax:

 :    '\F' printf-format-without-% '(' expr ')'
 |    '\F' printf-format-without-% '{' string '}'

Examples:

    "The value in hex is \Fx($value)."
    "You currently have \F020d($dollars) on your account."
    "Leave some --\Fs60{space for this $interpolates string}--."

I find this syntax reads very well. 
eg. "The value in hex is 'format hex $value'."

I like that it doesn't separate format specifier and
data like s?printf. Please note: I don't want to replace s?printf!

Is there something I have missed that would make this impossible or
impractical. Or maybe this feature already exists somewhere and I
don't know it?

best regards,
-Edwin

Reply via email to