Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re^2: Using Array::Diff

by Laurent_R (Canon)
on Dec 03, 2014 at 07:48 UTC ( [id://1109083]=note: print w/replies, xml ) Need Help??


in reply to Re: Using Array::Diff
in thread Using Array::Diff

This does only one part of the job, because works only one way: it detects elements in @new_array and not in @old_array, but not elements in @old_array which are not in @new_array (i.e. deleted elements). Arrat::Diff does the check in both ways.

Also, if the lists are long, the performance is not very good because you have essentially two loops (the smat match over an array being an implicit loop), so the complexity is higher than using hashes (which Array::Diff does, if I remember correctly).

Replies are listed 'Best First'.
Re^3: Using Array::Diff
by james28909 (Deacon) on Dec 03, 2014 at 08:11 UTC
    Yes, I am learning/migrating some of my own script to use hashes as well. They are indeed much faster than arrays in the few tests I tried. Sometimes, (or more like all the time lol) I wish I could go through the perldocs and everything just sink in clear and understandable the first time around.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (7)
As of 2024-03-28 11:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found