Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: How to count substitutions on an array

by Limbic~Region (Chancellor)
on Aug 13, 2016 at 02:08 UTC ( [id://1169685] : note . print w/replies, xml ) Need Help??


in reply to How to count substitutions on an array

Anonymous Monk,
Why are you trying to cram everything into a single line?
my $count = 0; for (@array) { # I've had no difficulty counting substitutions on individual lin +e replacements # my $individual_line_replacement_count = ...; $count += $individual_line_replacement_count; }

Cheers - L~R

Replies are listed 'Best First'.
Re^2: How to count substitutions on an array
by Anonymous Monk on Aug 13, 2016 at 02:29 UTC

    I didn't know how to do it in any way other than a *nested* "foreach" loop. On an array with tens of thousands of items, and needing to iterate through the entire array for a list of thousands of words/phrases, I might have been waiting a long time.

    I wish it were easier to search online for specific coding issues with programming. Sigh.

    Your solution works for me. Thank you very much.