@bits = ( $scalar =~ /.{1,$bytes}/gs );
Edited by tye to add "s" on the end otherwise "." won't match newlines.
Edited by chipmunk to change {0,$bytes} to {1,$bytes}; otherwise a null string is matched at the end.
In reply to Re: How can I split a string into chunks of size n bytes?
by Masem
in thread How can I split a string into chunks of size n bytes?
by tadman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |