my @w = split /\s+/,$text,31; pop @w; my $words30= join " ", @w; #### $text =~ m/^((?:\S+\s+){1,30})/; my $words30 = $1;