http://www.perlmonks.org?node_id=1027782


in reply to Get ranges from a list of numbers (like 1,2,3 => 1-3)

Well, searching "range from list" reveals the thread: [Solved] Converting a list of numbers to use a range operator, which suggests using Set::IntSpan's run_list method:
my @array = (2,3,4,10,11,12); my $set = new Set::IntSpan join(',', @array); my $list = $set->run_list; # $list is now "2-4,10-12"

Replies are listed 'Best First'.
Re^2: Get ranges from a list of numbers (like 1,2,3 => 1-3)
by Doctrin (Beadle) on Apr 09, 2013 at 19:04 UTC
    Thank you! That is exactly what I need!