sub apply_patterns { my ($string, @indexes) = @_; # Note $string is only a placeholder foreach my $idx (@indexes) { my $regex = $all_patterns[$idx]; s/$regex//; } }