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

Re^3: Splitting a string to chunks

by johngg (Canon)
on Nov 29, 2006 at 23:25 UTC ( [id://586840]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    my $padding = 8 - ($str % 8);
    
  2. or download this
    substr $arr[-1], -$padding, $padding, q{} if $padding;
    
  3. or download this
    my $padding = 8 - (length($str) % 8);
    
  4. or download this
    $ perl -le '$str = q{abc}; $pad = $str % 8; print $pad;'
    0
    $ perl -le '$str = q{abcdefghijkl}; $pad = $str % 8; print $pad;'
    0
    $
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-04-19 17:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found