foreach my $tool (@$tools) { my $edit_tool = $tool; $edit_tool =~ s//$file/ or next; }