in reply to Re^2: Counting matches and removing duplicates
in thread Counting matches and removing duplicates

Yes, of course. In your combined script, instead of printing each line of matches, simply push them onto @matches. There is no need to write them out and then read them in again.


🦛

Replies are listed 'Best First'.
Re^4: Counting matches and removing duplicates
by LexPl (Beadle) on Nov 15, 2024 at 16:42 UTC

    So instead of
    print {$out} "$1\n" while $xml =~ /$regex/g;
    , I would simply write

    my @matches; push(@matches, $1);
    and then continue with my code from entityStat.pl.

    Is that right?

      Yes, but you will need the same loop. ie.

      my @matches; push @matches, $1 while $xml =~ /$regex/g;

      🦛