in reply to Re: Substitute array value in regular expression
in thread Substitute array value in regular expression

If you want to rid yourself of the for loop every time you go through the while you could build up a combined regular expression match before entering the loop....something like:
use strict; use warnings; my @final_array=qw/test1 test2 fred/; my $regexp = "(" . join("|", @final_array) . ")"; while(<DATA>){ s/$regexp/pagingRAC/g; print $_; } __DATA__ this is a test this line contains test1 and test2 fred bassett is a dog but I can't spell his name.
This makes it a little cleaner for the eye.