Selection differences -> adds and removes

Jacqui Caren jacqui.caren at
Mon Nov 14 18:22:45 GMT 2005

A pretty standard problem.

I have a current set of integers (1,2,15)
and a updated set of integers (1, 4,15,19)

The actually appear as (sorted) comma delim'd strings
so I do an eq to decide if I need to do any work first.

I need a list of added values (4,19)
and a list of removed values (2)

Two options come to mind

a) use a hash to store current then iterate through
    populating added - whats left in the hash is the @del

b) iterate through the two stored lists, storing differences

The prior will work well for very short lists
but the latter is better for long lists?

Is there a perl module that holds such a utility function?


More information about the mailing list