Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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


Comment on Re: find the continuity in the data file
Select or Download Code
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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://951894]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2014-09-19 03:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (129 votes), past polls