Help for this page

Select Code to Download


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