%data = map { $_ => 1 } @F; sub range{ my(@ret); for ($_[0] .. $_[1]) { push(@ret, $_) if ($data{$_}); } return @ret; }