my $protein_re = qr|\[(NP_\d+)\]|; my $score_re = qr|R-score\s=\s(\d\.\d+)|; while ( $content_all =~ m{$protein_re} ) ..... while ( $content_all =~ m{$score_re} ) ....