use strict; use warnings; use LWP::Simple qw(get); my $seq = downloadUniprot("P31749"); print $seq; sub downloadUniprot { my $ac = shift; my $url = "http://www.uniprot.org/uniprot/".$ac.".fasta"; my $content = get($url); die "Couldn't get '$ac'!" unless defined $content; my @line = split/\R/, $content; shift @line; my $seq = ""; map {$seq .= $_} @line; return $seq; }