in reply to Splitting a long string

There are basically two ways. One is destructive to the original string, the other is not but means more code:
my $long_string = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; my $i = 0; my $readlength = 8; # non destructive while ( $i <= length($long_string) ) { my $part = substr( $long_string, $i, $readlength ); $i += $readlength; print "$part\n"; } # destructive while ( $long_string =~ s/^(.{1,$readlength})// ) { my $part = $1; print "$part\n"; }


holli, /regexed monk/