sub expandlist { local $" = '..'; # locally set list separator my (@parts); sort {$a <=> $b} map { map { ((@parts = split /-/) == 2) ? eval('map {$_} '. "@parts") : $_ } split /,/ } @_; }