Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^4: Counting matches and removing duplicates

by LexPl (Beadle)
on Nov 15, 2024 at 16:42 UTC ( [id://11162721]=note: print w/replies, xml ) Need Help??


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

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?

Replies are listed 'Best First'.
Re^5: Counting matches and removing duplicates
by hippo (Archbishop) on Nov 15, 2024 at 16:45 UTC

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

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

    🦛

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11162721]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (3)
As of 2025-11-19 06:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (72 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.