Something like below may do what you want. Although it's not exactly clear from your question why you want to do this, or what you have tried so far. You may get a better answer, if you can provide more details of what problem you are trying to solve and example code you have tried.
<code> Output: Perl 5 is a highly capable, feature-rich programming language with over 27 years of developmentuse strict; use warnings; my $sentence = 'Perl 5 is a highly capable, feature-rich programming l +anguage with over 27 years of development.'; my @words = split( ' ', $sentence); my $midpoint = sprintf("%d", scalar @words / 2); my ( @first_half, @second_half ); my $count = 0; for ( @words ) { push @first_half, $_ if $count <= $midpoint; push @second_half, $_ if $count > $midpoint; $count++; } print join( ' ', @first_half ) . "\n"; print join( ' ', @second_half ) . "\n";
In reply to Re: Break sentence into two part
by rnewsham
in thread Break sentence into two part
by Mjpaddy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |