In addition to the pack() solutions you'll find eventually, here are a couple substr() ones:
my @strings; push @strings, substr($string, 0, 6, '') while length $string;
or,
my @strings = map substr($string, 6*$_, 6), 0..length($string)/6;
Adjust edge cases as necessary, these are untested.
-Ken
On Monday, December 29, 2003, at 12:10 AM, Kim Helliwell wrote:
I have a long string of characters (> 40,000 chars) that I need to break up into strings of 6 chars each. Is there a simple way to do this in Perl? unpack() doesn't seem to be the right solution; there are no terminations for the strings I'm after.
Have I actually found something that is easier in C than in Perl?
Kim Helliwell [EMAIL PROTECTED] Homepage: http://homepage.mac.com/kimgh
