Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Generating ranges of numbers

by thezip (Vicar)
on Jun 30, 2016 at 18:00 UTC ( #1166945=note: print w/replies, xml ) Need Help??


in reply to Generating ranges of numbers

It is definitely more fun if you *don't* use Set::IntSpan...

#!/usr/bin/perl use strict; use warnings; use Set::IntSpan; my @array = ("1", "2", "3", "5", "6", "7", "9"); my $set = Set::IntSpan->new(\@array); my $out = join(',', $set->D($set->holes())); print $out, "\n";
OUTPUT: 1-3,5-7,9

*My* tenacity goes to eleven...

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2018-11-19 01:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My code is most likely broken because:
















    Results (206 votes). Check out past polls.

    Notices?