I'm not FASTA expert, but my approach would be to use ">" as input separator instead of "\n". And then simply push 100 lines (=sequences) into each file through rotor:
# beware first empty element
writer($_) for $fasta.IO.lines( nl-in => '>').[1..*].rotor(100, :partial);
sub writer (@seqs) {
...
# restore sequence start character
$out.print('>', $_); for $seqs;
};
Of course TIMTOWTDI, however - from my experience - delimiter approach is waaaaaaay faster than buffer juggling.
]]>$out.print('>', $_); for @seqs;
]]>