# simplified version: ignore header stuff: my %hash; while() { chomp; $hash{$_} = undef unless /^(?:ENTRY|TITLE|ORGANISM|ACCESSIONS)\s/; } print join " ", keys %hash, "\n";