[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] Bug in macperl or my code? (long)



I'm creating a script to convert Medline references to html list entries. 
The delimeter between each author is a semicolon, and I'd like to change
that to a comma.  Sample code follows, and sample references follows that. 
What puzzles me is that when I print $reference{AU}, I get a list of
authors, but when I print $refs{AU}, I get nothing.  Is there a problem
with passing hashes, or is my script just not stylistically correct?
Thanks for any help. 

-- Gene

----- Start -----
sub printref {
        my %refs = %reference;
        my ($journal, $date, $volume, $page);
# put in some debugging code here
        $refs{AU} =~ tr/;/,/;
# put in more debugging code here
        $refs{AU} = filter($refs{AU}); # This doesn't work

        $refs{TI} = filter($refs{TI}); # This does work
        
        $refs{SO} =~ /(\S+). (\d{4} \w{3} \d+); (\d+)\(?\d*\)?: (\d+-?\d*)/;
        $journal = $1;
        $date    = $2;
        $volume  = $3;
        $page    = $4;
        $journal =~ s/-/ /g;
        
        print $refs{AU},".\n";
        print "<B>",$refs{TI},"</B>\n";
        print "<EM>",$journal,"</EM>. ";
        print $date;
        print " <B>",$volume,"</B>: ";
        print $page,'.';
        print "\n</LI>\n";
}
        
while (@files) {
        $filename = shift(@files);
        open(F, $filename);
        while (<F>) {
                if (/^TI: /) {
                        $reference{TI} = $';
                        print "<LI>\n";
                        last;
                }
        }
        while (<F>) {
                if (/^(.{2,}?): /) {
                        if ($1 eq TI) {
                                printref;
                                print "<LI>\n";
                                undef %reference;
                        }
                        $reference{$1} = $';
                }
        }
        printref;
        close(F);
}
----- End -----
----- Sample References (slightly edited)  -----
        Record 1 of 2

TI: Growth hormone, interferon-gamma, and leukemia inhibitory factor 
promoted tyrosyl phosphorylation of insulin receptor substrate-1.
AU: Argetsinger-LS; Hsu-GW; Myers-MG Jr; Billestrup-N; White-MF; Carter-Su-C
AD: Department of Physiology, University of Michigan Medical School, Ann 
Arbor 48109-0622, USA.
SO: J-Biol-Chem. 1995 Jun 16; 270(24): 14685-92
ISSN: 0021-9258
PY: 1995
LA: ENGLISH
CP: UNITED-STATES
AB: The identification of JAK2 as a growth hormone (GH) 
receptor-associated, GH-activated tyrosine kinase has established tyrosyl 
phosphorylation as a signaling mechanism for GH. In the present study, GH 
MESH: CHO-Cells; Enzyme-Activation; Hamsters-; Molecular-Sequence-Data; 
Phosphorylation-; Phosphotransferases-Alcohol-Group-Acceptor-metabolism; 
TG: Animal; Human; Support,-U.S.-Gov't,-P.H.S.
PT: JOURNAL-ARTICLE
CN: RO1DK34171DKNIDDK; DK43808DKNIDDK; DK36836DKNIDDK
RN: EC 2.7.1; EC 2.7.1.-; EC 2.7.1.112; EC 2.7.1.137; 0; 0; 0; 0; 0; 0; 
55520-40-6; 82115-62-6; 9002-72-6
NM: Phosphotransferases-(Alcohol-Group-Acceptor); Janus-kinase-2; 
Protein-Tyrosine-Kinase; 1-phosphatidylinositol-3-kinase; 
AN: 95301563
UD: 9509
SI: GENBANK/M33324; GENBANK/D26177; GENBANK/M83336; GENBANK/M25764; 
GENBANK/S69336; GENBANK/S63728; GENBANK/L16956; GENBANK/L32955

        Record 2 of 2

TI: Mapping staphylococcal nuclease conformation using an EDTA-Fe 
derivative attached to genetically engineered cysteine residues.
AU: Ermacora-MR; Ledman-DW; Hellinga-HW; Hsu-GW; Fox-RO
AD: Howard Hughes Medical Institute, Yale University, New Haven, 
Connecticut 06520.
SO: Biochemistry. 1994 Nov 22; 33(46): 13625-41
ISSN: 0006-2960
PY: 1994
LA: ENGLISH
CP: UNITED-STATES
AB: Six single cysteine variants of staphylococcal nuclease were reacted 
with the iron complex of (EDTA-2-aminoethyl) 2-pyridyl disulfide (EPD-Fe) 
[Ermacora, M. R., Delfino, J. M., Cuenoud, B., Schepartz, A., & Fox, R. 
MESH: Computer-Graphics; Edetic-Acid-chemistry; Enzyme-Stability; 
Evaluation-Studies; Micrococcal-Nuclease-genetics; 
TG: Support,-Non-U.S.-Gov't; Support,-U.S.-Gov't,-P.H.S.
PT: JOURNAL-ARTICLE
RN: EC 3.1.31.1; 0; 0; 4371-52-2; 60-00-4; 7439-89-6
NM: Micrococcal-Nuclease; EDTA-(2-aminoethyl-2-pyridyl-disulfide)-Fe; 
Molecular-Probes; Cysteine; Edetic-Acid; Iron
AN: 95034797
UD: 9502

----- End of References -----