Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: A regex question...

by pfaut (Priest)
on May 05, 2003 at 18:40 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://255708]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (11)
As of 2024-04-19 16:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found