Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: how to split the string into two or three numbers based on certain value.

by 7stud (Deacon)
on Feb 12, 2013 at 19:18 UTC ( #1018431=note: print w/ replies, xml ) Need Help??


in reply to how to split the string into two or three numbers based on certain value.

use strict; use warnings; use 5.012; my $string = '79899920179'; my @results; my $number; while ($string =~ /(\d)/g) { $number .= $1; next if $number < 32; push @results, $number; $number = ""; } say for @results; --output:-- 79 89 99 201 79


Comment on Re: how to split the string into two or three numbers based on certain value.
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (3)
As of 2015-07-06 03:34 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 (70 votes), past polls