http://qs1969.pair.com?node_id=12275

Suppose you have a string with variable names in it. You want them to be expanded when you print it, but you're not sure how. Never fear, you can abuse eval()!
my $color = "red"; my $fruit = "apple"; my $name = "chromatic"; my $string = 'Hi, my name is $name. Please hand me a $color $fruit.'; print ">>$string<<\n"; # demonstrate what we have my $s2; eval "\$s2 = qq/$string/"; # the real magic print "->$s2<-\n"; # demonstrate the result