You're changing the array elements in-place. Once you've substituted away <infile>, it's gone for good. You could instead work on copies of the array elements:
foreach my $tool (@$tools) { my $edit_tool = $tool; $edit_tool =~ s/<infile>/$file/ or next; }
In reply to Re: Substitution operator troubles
by chromatic
in thread Substitution operator troubles
by sabkat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |