in reply to Subtracting Lists

See Set::IntSpan

From the doc : << Sets are stored internally in a run-length coded form. This provides for both compact storage and efficient computation. In particular, set operations can be performed directly on the encoded representation. >>

#!/usr/bin/perl -w use strict; use Data::Dumper; use Set::IntSpan; my $good_run_list = '1-5'; my $bad_run_list = '1,3'; my ( $good_set, $bad_set, $x_set ); if ( valid Set::IntSpan $good_run_list and valid Set::IntSpan $bad_run +_list ) { $good_set = new Set::IntSpan $good_run_list; $bad_set = new Set::IntSpan $bad_run_list; } else { print "Please verify your run lists\n" } $x_set = $good_set ^ $bad_set; # Or $x_set = $good_set->X($bad_set); finite $x_set and my @elements = elements $x_set; print Dumper \@elements; __END__ Output: $VAR1 = [ 2, 4, 5 ];

hth,
PooLpi

'Ebry haffa hoe hab im tik a bush'. Jamaican proverb