#!/usr/bin/perl use strict; use warnings; use Text::Balanced qw(:ALL); use Data::Dumper::Concise; my $text = ; my ($extracted, $remainder) = extract_multiple( $text, [ \&extract_quotelike ]); print Dumper($extracted, $remainder); __DATA__ q/%%% rick ran errands . sem( [ word(1001, 'rick'), word(1002, 'ran'), word(1003, 'errands'), word(1004, '.') ] , [ pos(1001, 'NN') , pos(1002, 'VBD') , pos(1003, 'NNS'), pos(1004, '.') ] )/;