Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: number sequence

by andye (Curate)
on Mar 23, 2007 at 18:03 UTC ( #606309=note: print w/replies, xml ) Need Help??


in reply to number sequence

Here's one way of doing it:

my $comb = '18,5,1790,19-66,212,213'; $comb =~ s/-/../g; my @uns; push @uns, eval "($_)" foreach split ',', $comb; print join "\n", sort { $a <=> $b } @uns;
Of course, using eval like this, you have to be able to trust the source data not to contain any nasties.

HTH, andye

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://606309]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2017-12-14 19:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (408 votes). Check out past polls.

    Notices?