⭐ in reply to How can I split a string into chunks of size n bytes?
@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 Section
Seekers of Perl Wisdom