Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re: find the continuity in the data file

by repellent (Priest)
on Feb 05, 2012 at 02:50 UTC ( #951894=note: print w/replies, xml ) Need Help??

in reply to find the continuity in the data file

use Set::IntSpan::Fast;
my @n = qw(16 107 108 110 112 114 115 117 118 119 120 121 122 123 124 +125 127 128 130 132 133 135 136 138 142 146 149 150 154 156 157 158 1 +59 161 162); my $set = Set::IntSpan::Fast->new; $set->add(@n); print $set->as_string, "\n"; __END__ 16,107-108,110,112,114-115,117-125,127-128,130,132-133,135-136,138,142 +,146,149-150,154,156-159,161-162

Replies are listed 'Best First'.
Re^2: find the continuity in the data file
by Anonymous Monk on Feb 05, 2012 at 07:35 UTC
    thanks for the reply. actually i want the continous block ie if have 50 to 500 the output should give 450 range. other than the number to be provided in the $limit.
      Great, write that part yourself :)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://951894]
[marto]: good morning all, snow day here, won't make it to the office
[Corion]: marto: Oof - that means taking a day off or can you work from home?
[marto]: Corion, I can do some non-technical things, but there's no way for me to connect to the clients network.
[marto]: which is a shame, I had a really productive day yesterday
[Corion]: marto: Meh, so it'll be a day of cleaning out email...
[marto]: and hoped that I'd be able to continue the momentum :)

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2018-01-16 08:47 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (175 votes). Check out past polls.