#!/usr/bin/perl use warnings; use strict; my $part_2 = "Not a good idea"; my $var1 = "part"; my $var2 = "2"; my $compound = eval "\$${var1}_$var2"; print "$compound\n"; __END__ There are three important things to note about this: 1. it is a really bad idea 2. the first $ must be escaped to avoid the first evaluation (the interpolation into the string) 3. $var1 must be in the form of ${var1} because $var1_ is a valid variable name