Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Range of numbers

by johndageek (Hermit)
on Oct 10, 2008 at 15:27 UTC ( [id://716478]=note: print w/replies, xml ) Need Help??


in reply to Range of numbers

if the numbers have same number of digits this could work
#check for 257 theough 313 @aon = ("100","134","259","290","310","314","330"); foreach $n (@aon){ print "$n\n" if ($n =~ /[2-3][1|5-9][0-3|7-9]/); }

Enjoy!
Dageek

Replies are listed 'Best First'.
Re^2: Range of numbers
by jvector (Friar) on Oct 10, 2008 at 17:11 UTC
    Fortuitous test set...
    #check for 257 theough 313 DB<1> @aon = ("100","134","259","290","310","314","330"); DB<2> foreach $n (@aon){print "$n\n" if ($n =~ /[2-3][1|5-9][0-3|7-9]/ +)}; 259 290 310 DB<3> push @aon,"217" # should fail DB<4> print join " ",@aon 100 134 259 290 310 314 330 217 DB<5> foreach $n (@aon){print "$n\n" if ($n =~ /[2-3][1|5-9][0-3|7-9]/ +)}; 259 290 310 217 DB<6>
    This signature will be ready by Christmas

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (10)
As of 2024-04-23 08:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found