in reply to A simple question that can't be asked

G'day Wiggins,

As you've already seen, "_{$v1}_" was close, and just needed a small adjustment: "_${v1}_".

Another option is to use a formatted string with sprintf or printf. Here's an example:

$ perl -e 'my ($v1, $v2) = qw{A B}; printf "_%s_%s_\n", $v1, $v2' _A_B_

Here's a further option. It's a bit unwieldy; probably not what you'd want to reach for first; but this type of solution (using join) can occasionally be useful:

$ perl -le 'my ($v1, $v2) = qw{A B}; print join "_", "", $v1, $v2, ""' _A_B_

A more appropriate context for using that join solution might be something closer to this:

$ perl -le 'my @x = "A" .. "Z"; print join "_", "", @x, ""' _A_B_C_D_E_F_G_H_I_J_K_L_M_N_O_P_Q_R_S_T_U_V_W_X_Y_Z_

— Ken