in reply to python like named placeholders sprintf ?

use Interpolation '%:$$->$' => sub {sprintf '%'.$_[0], $_[1]}; my $x = 41.758; my $name = "Jenda"; print "Hello $%{'06d'}{$x} or $%{' 10.5f'}{$x}, $%{'20s'}{$name}, and +so forth\n"; $x = 1.7; $name = "Leaveolus"; print "Hello $%{'06d'}{$x} or $%{' 10.5f'}{$x}, $%{'20s'}{$name}, and +so forth\n";

The need for the singlequotes inside the curlies makes it a little less nice, but I do not see a way around that. OTOH, you can add your own formats by modifying the subroutine in that use statement. Or you can define different interpolations if you like:

use Interpolation 'S' => sub { local $_ = sprintf("%.2f", shift()); 1 while s/^(-?\d+)(\d{3})/$1,$2/; '$'.$_; }; #... print "And the total price is $S{$Price}.\n";