# returns data structure
- my ( @lines, $i, %hash, $ft, $seq, $key, $val );
+ my ( @lines, $i, %hash, $ft, $seq, $key, $val, $ref );
@lines = split "\n", $entry;
$val = $2;
if ( $key =~ /RN|RX|RP|RG|RA|RT|RL/ ) {
- add_ref( \%hash, \@lines, $i, $args->{ "keys" } ) if $key eq "RN";
+ add_ref( \%hash, \@lines, $i, $args->{ "keys" } ) if $key eq "RN";
} elsif ( exists $hash{ $key } and $key eq "FT" ) {
$hash{ $key } .= "\n" . $val;
} elsif ( exists $hash{ $1 } ) {
# Returns nothing.
- my ( %ref );
+ my ( %ref, $key, $val );
if ( $args )
{
- while ( $lines->[ $i ] =~ /^(\w{2})\s+(.*)/ and $1 ne 'XX' and exists $args->{ $1 } )
+ while ( $lines->[ $i ] =~ /^(\w{2})\s+(.*)/ )
{
- if ( exists $ref{ $1 } ) {
- $ref{ $1 } .= " " . $2;
- } else {
- $ref{ $1 } = $2;
+ $key = $1;
+ $val = $2;
+
+ last if $key eq "XX";
+
+ if ( exists $args->{ $key } )
+ {
+ if ( exists $ref{ $key } ) {
+ $ref{ $key } .= " " . $val;
+ } else {
+ $ref{ $key } = $val;
+ }
}
$i++;