I think you want something more like this. I'm guessing a little on some of the code.
Otherwise I factored out all the common code, which as far as I can tell is everything but the url.
sub blast_hu_parse {
my($maid,$maid_dir) = @_;
my $url_hu = "http://hu_seq/";
blast_parse($maid,$maid_dir,$url_hu);
}
sub blast_hd_parse {
my($maid,$maid_dir) = @_;
my $url_hd = "http://hd_seq/";
blast_parse($maid,$maid_dir,$url_hd);
}
sub blast_parse{
my($maid,$maid_dir,$url) = @_;
my $h_file = get($url.$maid);
my $ltvec_small = $maid_dir.$maid."Ltvec_small.fa";
#what is $hu where is it declared?
#open ($hu);
#what is $in where is it declared
my $seq=<$in>;
close($in);
open (my $hu, ">".$maid.".fa");
print $hu ">$maid\n$seq";
close($hu);
# syntax
# bl2seq -p blastn -i nucleotide1 -j nucleotide2 -F F -D 1
my $command = "bl2seq -p blastn -i $ltvec_small -j $h_file -F F -D
+
+1";
print $command,"\n";
open OUTPUT, '>', "$maid_dir\\".$maid."_bl2seq.out" ;
STDOUT->fdopen( \*OUTPUT, 'w');
system($command);
bl2seq_parse();
}
update added some comment on the file handling stuff, which appears to have some errors, after looking over the original again