in reply to Advanced replace function
You may be looking for the /g option to s///:
my $str="abc t[poop1] def [doop2] [woop3] xyz";
$str =~ s/\[.*?\]/~~/g;
abc t~~ def ~~ ~~ xyz
But that's risky, especially if you use it a larger pattern. The /.*?/ could match a "[" or a "]". That's obviously undesirable. The following pattern avoids that problem:
Frying pan on the stove
Results (388 votes). Check out past polls.