in reply to about where to check the flag
#!/usr/local/bin/perl use strict; # pull everything into a string my $str = join("",<DATA>); # dump the newlines $str =~ s/\n/ /g; # loop through the records (// delimited) foreach (split(m!//!,$str)) { last unless /\S/; # skip that pesky last blank + record my ($title,@flags) = split(m!/!); # break out the fields (/ de +limited) $title =~ s/\s+/ /g; # kill extra whitespace print "References:$title\n"; # print the title foreach (@flags) { # loop through the fields my ($key,$value) = split(/=/); # split into pairs $value =~ s/\s+/ /g; # kill extra whitespace print ucfirst($key)."\t$value\n"; # print each one } print "\n"; } __DATA__ TITLE An excitatory scorpion toxin with a distinctive feature: an additional alpha helix at the C terminus and its implicati +ons for interaction with insect sodium channels /interaction_site="Q8, N9, Y10, N11, C12, F17, W38, R58, +V59 and K62 form the putative bioactive surface in mature toxin (Zilberberg et al., 1997)." /channel="Sodium channel" /target_cell="Insect specific (Excitatory)" /c_end="Free" // TITLE Cloning and Sequencing of an Excitatory Insect-Selective Neu +rotoxin BmKIT cDNA from Buthus martensii Karsch /interaction_site="Sequential deletions of C-terminal resi +dues suggested Ile73 and Ile74 for toxicity. {Oren et al., 1999}" /channel="Sodium channel" /c_end="Free" //
#!/usr/local/bin/perl use strict; my $str; # holds the records #loop through the data while (<DATA>) { chomp; # kill newlines if (m!//!) { # we have a record my ($title,@flags) = split(m!/!,$str); # break out the fields(/ d +elimited) $title =~ s/\s+/ /g; # kill extra whitespace print "References:$title\n"; # print the title foreach (@flags) { # loop through the fields my ($key,$value) = split(/=/); # split into pairs $value =~ s/\s+/ /g; # kill extra whitespace print ucfirst($key)."\t$value\n"; # print each one } print "\n"; $str = ""; # zero the input buffer } else { $str .= " " . $_; # accumulate data } } __DATA__ TITLE An excitatory scorpion toxin with a distinctive feature: an additional alpha helix at the C terminus and its implicati +ons for interaction with insect sodium channels /interaction_site="Q8, N9, Y10, N11, C12, F17, W38, R58, +V59 and K62 form the putative bioactive surface in mature toxin (Zilberberg et al., 1997)." /channel="Sodium channel" /target_cell="Insect specific (Excitatory)" /c_end="Free" // TITLE Cloning and Sequencing of an Excitatory Insect-Selective Neu +rotoxin BmKIT cDNA from Buthus martensii Karsch /interaction_site="Sequential deletions of C-terminal resi +dues suggested Ile73 and Ile74 for toxicity. {Oren et al., 1999}" /channel="Sodium channel" /c_end="Free" //
|
|---|