in reply to Re: extracting from text
in thread extracting from text

just for fun:
my @data = ([1,30], [40, 50], [25, 37], [60, 70], [50, 60], [65, 99]); my @data = map { my ($a, $b) = split/:/; [$a, $b]; } split / /, join ':', map { my @d = split / /; scalar @d > 1 && $d[0]>=$d[1] ? ():"@ +d" } split /:/, join ' ', map {"$_->[0]:$_->[1]"} sort {$a->[0] <=> $b->[0]} @data;
the data is sorted by start, then the AoA is converted to "1:30 25:37 40:50 ...". at this point this data is splitted by ":" getting "1", "35 25" and so on. if there is a pair of numbers and the first is >= the second, they are collapsed. data is then splitted again to obtain the original format AoA.
Oha