use strict; use warnings; use feature 'say'; my $text = do{ local $/; }; say $text =~ /Screening Ligands by X-ray crystallography/ ? 'MATCH!': 'NOPE'; __DATA__ --------- EFETCH RESULT(1..3): [ 1. Methods Mol Biol. 2014;1140:315-23. doi: 10.1007/978-1-4939-0354-2_23. Screening Ligands by X-ray crystallography. Davies DR(1). Author information: #### use strict; use warnings; use feature 'say'; my $text = do{ local $/; }; my @pmids = $text =~ /PMID:\s+(\d+)/gm; say for @pmids; __DATA__ --------- EFETCH RESULT(1..3): [ Some title some author Author information: blah blah blah PMID: 24590727 --------- EFETCH RESULT(1..3): [ Some title some author Author information: blah blah blah PMID: 45867737 --------- EFETCH RESULT(1..3): [ Some title some author Author information: blah blah blah PMID: 52497072 #### ####