$id_to_match="1QJ8:A|PDBID|CHAIN"; while(<>) { if($_=~/$id_to_match/) }