use strict; use warnings; use Lingua::Concordance; my $text = < acoustic guitar in local folk clubs. At this time, he already had two fifteen-minute instrumental pieces in which he would "go through all <2>sorts of moods", precursors to his landmark 1970s' compositions. In his early teens, Oldfield was involved in a 'beat group' <3>playing Shadows-style music (he has often cited Hank Marvin as a major influence, and would later cover The Shadows' song "Wonderful Land"). TEXT my $concordance = Lingua::Concordance->new(); $concordance->text($text); my @parts = split /\s*(<\d+>)\s*/, $concordance->text(); my @frags; unshift @parts, '' if $parts[0] !~ /^<\d+>$/; push @frags, map {$_->[0] =~ s/[<>]//; $_} [splice @parts, 0, 2] while @parts; $concordance->query('in'); for my $fragment (@frags) { my ($tag, $fragText) = @$fragment; $concordance->text($fragText); print "$tag: $_\n" for $concordance->lines(); }