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?
!!
I'm presuming the string is in a file. This script writes such a file and does what you want. But TMTOWTDI
my ($s, $f, $i) = qw~sixsix /tmp/50000.txt~ ; open F, ">$f"; for (1..12 ) {$s .= "$s" ;print F $s;} close F;
sysopen FIN, $f, 0 ; while (sysread FIN, $s, 6) {++$i ; print "$i. $s\n"}
JD