Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Splitting a string to chunks

by Limbic~Region (Chancellor)
on Nov 29, 2006 at 13:50 UTC ( [id://586699]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my @arr = unpack('A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8A8', $str);
    
  2. or download this
    # No longer wins but is still faster than '(A8)*'
    my @arr = unpack((join '', ('A8' x ($strlen / 8))), $str);
    
  3. or download this
    #!/usr/bin/perl
    use strict;
    ...
    substr_map 82.3/s       115%        55%         --        -8%       -4
    +5%
    unpack     89.5/s       134%        69%         9%         --       -4
    +0%
    substr_for  149/s       291%       182%        81%        67%         
    +--
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (3)
As of 2024-03-29 04:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found