Capitalize all letters after a period and a space
<p>I am trying to capitalize all occurrences of small letters after a period and a space using Perl. This is an example of an input:</p>

<pre><code>...so, that's our art. the 4 of us can now have a dialog. we can have a conversation. we can speak to...
</code></pre>

<p>This is the output I'd like to see:</p>

<pre><code>...so, that's our art. The 4 of us can now have a dialog. We can have a conversation. We can speak to...    
</code></pre>

<p>I have tried multiple regexes without much success--for instance:</p>

<pre><code>$currentLine =~ s/\.\s([a-z])/\. \u$1/g;
</code></pre>

<p>or</p>

<pre><code>$currentLine =~ s/([\.!?]\s*)(\w)/$1\U$2/g;
</code></pre>

<p>But I don't get the intended result. Help please!</p>

<h1>UPDATE</h1>

<p>To provide context, as somebody pointed out, the problem may lie elsewhere. The regexes are used in the context of this little script which does a few things besides the step that originated this post. I run it on long SRT files obtained from video closed captions. Thanks again for your help.</p>

<pre><code>#! perl
use strict;
use warnings;

my $filename = $ARGV[0];

open(INPUT_FILE, $filename)
    or die "Couldn't open $filename for reading!";
while (&lt;INPUT_FILE&gt;) {
        my $currentLine = $_;   
        # Remove empty lines and lines that start with digits
        if ($currentLine =~ /^[\s+|\d+]/){
            next;
        }

        # Remove all carriage returns
        $currentLine =~ s/\R$/ /;

        # Convert all letters to lower case
        $currentLine =~ s/([A-Z])/\l$1/g;

        # Capitalize after period &lt;= STEP THAT DOES NOT WORK
        $currentLine =~ s/\.\s([a-z])/\. \u$1/g;        

        print $currentLine;
}
close(INPUT_FILE);
</code></pre>