use String::Interpolate qw( interpolate); my $t = '$1$2'; or my $t = $ARGV[0]; my $p = interpolate($t);