in reply to Consecutive number checking

The module Set::IntSpan will do this.
#!/usr/bin/perl use strict; use warnings; use Set::IntSpan; my @array = (1,5,6,7,8,55,63,77,89,103,104,105,106,200,215,554); my $set = Set::IntSpan->new(join ",", @array); my $run = $set->run_list; print $run; *** Output 1,5-8,55,63,77,89,103-106,200,215,554