my $text; { local $/ = undef; open my $fh, 'file_name' or die "Damn $!"; $text = <$fh>; } $text =~ tr/\n/ /; my @arr = split /(?<=[.,;])\s*(?=[A-Z])/, $text; foreach (@arr) { print ':', $_, ":\n"; }