Foreach-loop for and print commands How can I make the following code shorter or efficient (maybe with other loops or other nice ideas), and keep the current functionality?

my $examine = shift; my $detect = 0;
foreach my $ProteinDB (@DB) {
    my $Set =  $ProteinDB-&gt;{'ID'};
    if($Set =~ /$examine/) {
        $detect = 1;
        my @Pointer = keys(%$ProteinDB);
        foreach my $key (@Pointer) {
            if($key ne "ID" &amp;&amp; $key ne "SQ") {
                print "$key " . $ProteinDB-&gt;{$key} . "\n";
                print "\n";
            }
        }
        print "SQ  " . $ProteinDB-&gt;{"SQ"} . "\n";
        print "//\n";
    }
}
if($detect == 0) {
    print "Error : For the ID $examine NO-Entry could be Found !\n";
}


It's nice code and easy to understand, but I don't have that experience that I can tell what I can do more with this code.  I am gonna keep trying to change it until it's shorter.
This is shorter, but not necessarily more efficient,

my $examine = shift; my $detect = 0;
for my $ProteinDB (@DB) {
    next if $ProteinDB-&gt;{'ID'} !~ /$examine/;
    $detect = 1;
    print "$_ $ProteinDB-&gt;{$_}\n\n"
      for grep $_ ne "ID" &amp;&amp; $_ ne "SQ", keys %$ProteinDB;
    print "SQ  $ProteinDB-&gt;{SQ}\n//\n";
}
$detect or print "Error : For the ID $examine NO-Entry could be Found !\n";


and if you push it little more,

my $examine = shift; my $detect = 0;
print map {
    $detect = 1;
    my $ProteinDB = $_;
    (
      (map "$_ $ProteinDB-&gt;{$_}\n\n", grep $_ ne "ID" &amp;&amp; $_ ne "SQ", keys %$ProteinDB),
      "SQ  $ProteinDB-&gt;{SQ}\n//\n"
    );
  }
  grep $_-&gt;{ID} =~ /$examine/, @DB;
$detect or print "Error : For the ID $examine NO-Entry could be Found !\n";