use strict;
use warnings;

use Bio::DB::GenBank;
use Bio::Seq;
use Bio::SeqIO;

my @id;

open (S, "hiv_ids.txt");
while (<S>) {
  chomp;
  push @id, split /, /;
}
close (S);

print "@id\n";

my $seqio_obj = Bio::SeqIO->new(-file => '>hiv.fasta', -format => 'fasta' );

my $db_obj = Bio::DB::GenBank->new;

foreach my $swiss_id (@id) {

  my $seq_obj = $db_obj->get_Seq_by_id($swiss_id);

  $seqio_obj->write_seq($seq_obj);
}
