Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
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?
[ambrus]: As for TeX, I'm not trying to discourage anyone from writing carefully beautifully typeset documents, in maths or outside. But most people aren't willing to do that, and will spend only little time about the formatting,
[ambrus]: and try to leave everything else to automated systems without checking how what they write came out format-wise, and for those people, discounting the part about journals with a specific format above,
[ambrus]: just blindly recommending to use LaTeX is a bad idea now.

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (9)
As of 2017-09-26 11:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    During the recent solar eclipse, I:









    Results (293 votes). Check out past polls.

    Notices?