in reply to Re: string length problems
in thread string length problems

This is the line where i split the string at a user defined value ($window).
$seq =~ s/(.{$window})/$1\n/g;
who can I split this the same using substr?

Replies are listed 'Best First'.
Re: Re: Re: string length problems
by ysth (Canon) on Jan 23, 2004 at 11:33 UTC
    for (my $pos = $window; $pos <= length($seq); $pos += $window+1) { substr($seq, $pos, 0, "\n"); }
    is the least ugly I could come up with.