Use the modifier /gfor global matching.
my @matches = ($result =~ m/INFO\n(.*?)\n/g);
Len quantification in this case is not needed, because it .does not correspond to new lines. The following will give better performance:
my @matches = ($result =~ m/INFO\n(.*)\n/g);
/scan be used if you want periods to match newlines. See perlre for more on these modifiers .
source
share