in reply to Re: Recommendations for efficient data reduction/substitution application
in thread Recommendations for efficient data reduction/substitution application
Called in array context, the result will be defined for all the indices where your regular expression matched. Thus allowing:my $main_re = do { local $" = ')|)(?=.*?('; my @REs = map $_->{from}, @conversions; qr/^(?=.*?(@conversions)|)/; };
With backreferences, it's still possible but you'll have to map offsets. With dependencies between results, you could do something similar, but would have to map out Markov chains.my @scan = $entry{$k} =~ $main_re; for my $i (0..$#scan) { next unless defined $scan[$i]; $entry{$k} =~ s/$conversions[$i]{from}/$conversions[$i]{to}/g; conversions[$i]{count}++; }
Probably more suggestions to be had with more details on the system.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|
|---|