Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: split with a delimiter, every 4 time it occurs.

by hdb (Monsignor)
on Jul 01, 2013 at 07:10 UTC ( [id://1041767]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    use strict;
    use warnings;
    ...
    my @pieces = $to_split =~ /('\w'(?:,'\w'){0,4})/g;
    $"="\n";
    print "@pieces\n";
    
  2. or download this
    use strict;
    use warnings;
    ...
    my @pieces = grep {$_} split /('\w'(?:,'\w'){0,4}),?/, $to_split;
    $"="\n";
    print "@pieces\n";
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (8)
As of 2024-03-28 19:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found