On Dec 28, 2003, at 10:10 PM, 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.

Maybe that works for you?


my $string = 'string_of_40k_chars';
my @strings = $string =~ /.{6,6}/g;
my $remainder = substr($string, -1, length($string)%6);


Have I actually found something that is easier in C than in Perl?

I couldn't tell.


/h




Reply via email to