$l .= $_ foreach <DATA>; while($l =~s/(\w):\s?(\d+)-(\d+)//){ $h{$1}{$_} = 1 for ($2 .. $3); } for $k (sort keys %h){ print "\n$k: "; for (sort {$a <=> $b} keys %{$h{$k}}){ print "$_ " if $h{$k}{$_-1} == 0; print "- $_ " if $h{$k}{$_+1} == 0; } } __DATA__ a:10-34 b:9-12 c:12-24 e: 1-9 a:1-8 a: 19-24 b:2-6 a:7-11 d:9-23 e: 12-23
In reply to Re: Union of overlapping numeric intervals
by Lennotoecom
in thread Union of overlapping numeric intervals
by onlyIDleft
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |