Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Finding Recurring Elements in HoHoA

by anonymized user 468275 (Curate)
on Aug 04, 2005 at 10:03 UTC ( #480750=note: print w/replies, xml ) Need Help??


in reply to Finding Recurring Elements in HoHoA

The '$cur eq $nxt' test will always compare an entry with itself at some time during each execution of the loop, thus finding a false duplicate. However, the print is driven by $count, which scopes within a state, which has the effect also of hiding the duplicate test. In a correct solution, duplicates need to be detected across states and the print needs to address a uniquified list of everything that was found in a successful duplicate test.

Update: As the other replies suggest - this uniquify idea is best implemented in a summary hash that matches your output.

One world, one people

  • Comment on Re: Finding Recurring Elements in HoHoA

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2023-03-22 22:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (60 votes). Check out past polls.

    Notices?