Perl Monk, Perl Meditation | |
PerlMonks |
Re: Matching multiple substrings of a string to arrays and printing those that matchby choroba (Cardinal) |
on Apr 03, 2018 at 19:48 UTC ( [id://1212286]=note: print w/replies, xml ) | Need Help?? |
This assigns the $f1_line to the first element of the array, and deletes anything else. You probably meant push instead.
index's second argument is a substring, not an array, and definitely not a boolean AND of the sizes of two arrays (@arr1 && @arr2 returns 0 if @arr1 is empty, and size of @arr2 otherwise). Update: You might need to remove leading, trailing, or repeated commas from the last column after processing by the following code:
It builds two regexes, one for the approved verbs, and one for the discarded ones. Lines are printed only when the approved regex matches, and all discarded verbs are removed by the substitution.
In Section
Seekers of Perl Wisdom
|
|