Advertisement
cd62131

split line at period

Jan 19th, 2014
259
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.30 KB | None | 0 0
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4. use utf8;
  5. use open qw(:encoding(utf8) :std);
  6. open my $in, '<', 'dat' or die;
  7. my $prev = 0;
  8. while (<$in>) {
  9.   chomp;
  10.   if (/\A\.\z/) {
  11.     print ".\n";
  12.     $prev = 0;
  13.     next;
  14.   }
  15.   if ($prev) {
  16.     print ' ';
  17.   }
  18.   print $_;
  19.   $prev = $_;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement