in reply to loop/substitution problem
$/=""; my $randstr = rvg(); while(<FILE>) { s/(?<!\\)(\$\w+(?![\[{\w]))/$randstr/g; print; } [download]