# OK, users can write a variable name between {} brackets: while ($text =~ m/{([^\}]*}/g ) { #do some interpolation }