Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Can split split against more than one character in a string of the same character?

by johngg (Canon)
on Jul 15, 2019 at 22:12 UTC ( [id://11102899]=note: print w/replies, xml ) Need Help??


in reply to Can split split against more than one character in a string of the same character?

Another approach would be to use unpack.

johngg@shiraz:~/perl/Monks$ perl -Mstrict -Mwarnings -E ' my $str = q{aaaaaaaaa}; my @parts = unpack q{(a2)*}, $str; say qq{@parts};' aa aa aa aa a

I hope this is helpful.

Cheers,

JohnGG

  • Comment on Re: Can split split against more than one character in a string of the same character?
  • Download Code

Replies are listed 'Best First'.
Re^2: Can split split against more than one character in a string of the same character?
by Don Coyote (Hermit) on Jul 15, 2019 at 22:35 UTC

    That looks fast!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2024-04-19 14:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found