Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env perl
- use strict;
- use warnings;
- my @ar;
- while (<>) {
- chomp;
- my ($i, $j) = (0, 0);
- for (; $i < length; ++$i) {
- my $s = substr $_, $i, 1;
- if ($s eq ' ' || $s eq '.' || $s eq ',') {
- push @ar, substr $_, $j, $i - $j;
- $j = $i + 1;
- }
- }
- if ($i != $j) {
- push @ar, substr $_, $j, $i - $j;
- }
- }
- print join ' ', @ar;
- print "\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement