Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
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
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?
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 meditating upon the Monastery: (11)
As of 2015-07-31 08:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (275 votes), past polls