>perl -le"print sprintf '%2$s %1$s', qw( a b )" b a #### $hello = "Hello $name"; #### use String::Interpolate qw( ); sub format { my ($pat, $args) = @_; my $t = String::Interpolate->new($args); $t->($pat); return "$t"; } my $hello = format('Hello $name', { name => 'World' });