for (values %hash) { @$_ = map {!/^(\d+)-(\d+)$/ ? $_ : ($1 < $2) ? ($1..$2) : reverse ($2..$1)} @$_; }