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

Re: A regex question...

by pfaut (Priest)
on May 05, 2003 at 18:40 UTC ( #255708=note: print w/replies, xml ) Need Help??


in reply to A regex question...

#!/usr/bin/perl -w use strict; my $str = '012345678901234567890123456789'; my @arr1 = $str =~ /(\d{5})/g; my @arr2; while (@arr1) { push @arr2, join('-', splice(@arr1,0,3)) } print join('<br>',@arr2),$/;

Output:

01234-56789-01234<br>56789-01234-56789
90% of every Perl application is already written.
dragonchild

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2021-03-04 18:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My favorite kind of desktop background is:











    Results (107 votes). Check out past polls.

    Notices?