Hi List,

I am trying to write a small script to parse bibliographic references like
this:

Morgan, M.J., Wilson, C.E., Crim, L.W., 1999. The effect of stress on
reproduction in Atlantic cod. J. Fish Biol. 54, 477-488.

What I want to be able to do eventually is parse each name separately and
associate that with the title. I am not sure how yet, but I haven't even got
there.

Right now I am just trying to see if I can parse the names, so I came up
with this:

foreach (@entries){
    if (/((\w)*, (([A-Z].)*),){1,}/){
 my $name = "$&";
         $name =~ s/\.,/\. /g;
 push @names, $name;
    }
}

It works fine for the first name, but as expected if @entries contain
several strings with authors names (I did that by matching the year and
storing $` in the @entries) it will match the first author and it will go to
the next $entries. Is there a way to match the pattern more than once, but
to store each match separately? For example, would I be able to store
Morgan, M.J. as one item in an array and Wilson, C.E. as another one?

As always, any help is much appreciated.

Cheers,

Tiago
-- 
"Education is not to be used to promote obscurantism." - Theodonius
Dobzhansky.

"Gracias a la vida que me ha dado tanto
Me ha dado el sonido y el abecedario
Con él, las palabras que pienso y declaro
Madre, amigo, hermano
Y luz alumbrando la ruta del alma del que estoy amando

Gracias a la vida que me ha dado tanto
Me ha dado la marcha de mis pies cansados
Con ellos anduve ciudades y charcos
Playas y desiertos, montañas y llanos
Y la casa tuya, tu calle y tu patio"

Violeta Parra - Gracias a la Vida

Tiago S. F. Hori
PhD Candidate - Ocean Science Center-Memorial University of Newfoundland

Reply via email to