Introduction to Protein Databases

Author: L. Grondin

http://rosalind.info/problems/dbpr/

Sample input

Q5SLP9

Sample output

DNA recombination
DNA repair
DNA replication

Source code: dbpr-grondilu.pl

use v6;

use LWP::Simple;

sub MAIN(Str $id = "Q5SLP9") {
    my $id-fname = $*SPEC.catdir($*PROGRAM-NAME.IO.dirname, "$id.txt");
    my $input = $id-fname.IO.e
        ?? $id-fname.IO.slurp
        !! LWP::Simple.get(qq{http://www.uniprot.org/uniprot/$id.txt});
    for split "\n", $input {
        if / GO\; .* \sP\: (.*?)\;/ {
            say $/[0].Str
        }
    }
}