use strict; use warnings; my $text = q{ I need to extract the first several words from a paragraph of text contained in a $var, so as to get the longest extract that's less than or equal to 200 characters. My brute-force-and-ignorance method is: blah some more text here etc etc }; my $chunk; ($chunk) = $text =~ /^(.{1,200})(?