With a module, I could get a cleaner interface:
use List::Compare;
$lc = List::Compare->new(\@master, \@sources);
$subset_status = $lc->is_LsubsetR();
But why stop at just subset relationships? How about these:
@intersection = $lc->get_intersection();
@union = $lc->get_union();
@unique = $lc->get_unique;
@complement = $lc->get_complement();
@symmetric_difference = $lc->get_symmetric_difference;
Perl Cookbook uses seen-hashes to derive these relationships between 2 lists.
Brainstorm: If I modularized this code, I'd never have to re-type it in a script.
Previous | Back to start of show | Next |
Slide: 5 module_birth | © 2004-18 James E. Keenan |