while (my $text = ) { if ($text =~ /['"](.+?)['"]/ ){ print "Found $1 \n"; } else { print "Out of luck \n"; } }