in reply to Number lists to number ranges (was: my head is reeling...)

Set::IntSpan

perl -e 'use Set::IntSpan;print Set::IntSpan->new(@ARGV)->run_list,$/' + "1,2,8,9,10,11,12,43,66,109,121,122,123,657" 1-2,8-12,43,66,109,121-123,657