foreach (keys %global_variables) { $content =~ s/\$\($_\)/$global_variables{$_}/g; }