Hello, everybody!
I am looking for the procedure reversed to cat.
I would like to separate a long fasta-file into many single fasta sequences, so each sequence from the large fa-file will be situated in a new small file.fa each. I usually used something like the following, but it not as good as it looks like... Where is the mistake?
Many thanks for your help!
N.
sub get_fasta {
  my $inputName = $_[0];
  my $fh;
# new input record separator for fasta-files
  $/ = "\n>";
open ($fh, $inputName) or die "cannot open file: $!\n";
my @entries = <$fh>;
 # remove last character '>' except for the last entry
  chop(@entries[0..$#entries - 1]);
# add '>' except for the 1st entry
  foreach (@entries[1..$#entries]) {$_ = '>'.$_;}
# print"@entries";
close($fh);
  $/="\n";
  return \@entries;
Since you were trying for a Perl solution, this answer will help: Splitting A Fasta File
Here are some more solutions for you in other posts:
Thank you, I've missed really a lot.
Natasha