sample values of @gl CD9 TBN NANOG KITL FUT4 SALL4 MYC STAT3 ESRRB AKP2 SOX2 POU5F1 KLF4 #### sample of @hfr_genes LYPLA1 LYPLA1 LYPLA1 LYPLA1 LYPLA1 LYPLA1 LYPLA1 LYPLA1 LYPLA1 LYPLA1 #### my code: do { if( my$index_gl=grep{$hfr_genes[$_]=~/^$gl[$index]$/}0..$#hfr_genes) { print TEST "Val $gl[$index] is present $index_gl times\n"; $index++; } else { $index++; } } until ($index==(scalar(@hfr_genes)));