my $s = 'hello world! how are you? whoops, forgot.';
my @no_caps = $s =~ /[.?!]\s*((?![A-Z])[a-z]\w+)/g;
####
$s =~ s/^((?![A-Z])[a-z]\w+)/ucfirst$1/e;
$s =~ s/([.?!]\s*)((?![A-Z])[a-z]\w+)/$1.ucfirst$2/eg;
####
use strict;
@ARGV = '/Perl/LearningPerl/Test';
while(<>){
if (/^((?![A-Z])[a-z]\w+)/) {
print "$1 is not capitalized\n";
}
while (/([.?!]\s*)((?![A-Z])[a-z]\w+)/g) {
print "$2 is not capitalized\n";
}
}
####
my $file = do {local $/; <>};
if ($file =~ /^((?![A-Z])[a-z]\w+)/) {
print "$1 is not capitalized\n";
}
while ($file =~ /([.?!]\s*)((?![A-Z])[a-z]\w+)/g) {
print "$2 is not capitalized\n";
}