Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Generating ranges of numbers

by thezip (Vicar)
on Jun 30, 2016 at 18:00 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1166945]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2024-04-19 23:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found