http://qs1969.pair.com?node_id=342416

   1: #!/usr/bin/perl -w
   2: 
   3: use strict;
   4: use Bio::DB::GenBank;
   5: use Bio::SeqIO;
   6: use File::Basename;
   7: 
   8: # configuration information
   9: my $outfile  = 'outfile';
  10: my $progname = basename $0;
  11: 
  12: # usage information
  13: my $usage = "usage:  $0 accession1 [accession2 ...]\n";
  14: die $usage unless @ARGV;
  15: 
  16: # start program flow
  17: my $gb = new Bio::DB::GenBank( 
  18:    -retrievaltype => 'tempfile', 
  19:    -format => 'Fasta'
  20: );
  21: 
  22: my $seqout = Bio::SeqIO->new( -file => ">$outfile", -format => 'FASTA' );
  23: 
  24: my $seqio = $gb->get_Stream_by_acc( @ARGV );
  25: while( my $sequence =  $seqio->next_seq ) {
  26:    $seqout->write_seq($sequence);
  27: }