use strict; use warnings; while (my $text = ) { if ($text =~ /(['"].*?['"])/ ){ print "Found $text \n"; } else { print "Out of luck \n"; } } __DATA__ "Mary and a little lamb", she said. She thought 'Hang on a tick' Nobody loves me "Mary and a large lamb"