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";