Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^4: Counting matches and removing duplicates

by LexPl (Sexton)
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 sharing their wisdom with the Monastery: (5)
As of 2025-02-15 14:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found