Advertisement
Guest User

Untitled

a guest
May 4th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.40 KB | None | 0 0
  1. #!/usr/bin/perl
  2.  
  3. open(FILE, "$ARGV[0]") or die "Could not open file: $ARGV[0]";
  4. my $counter = 0;
  5. while(<FILE>) {
  6.     @words = split /[.?!]/, $_;
  7.     foreach $word (@words) {
  8.         if($word =~ /([0-9])/){
  9.             if($word =~ s/($ARGV[1]\b)/\u$1/) {
  10.                 print $word2;
  11.                 $counter++;
  12.             }
  13.             print $word . " ";
  14.         }
  15.         else{
  16.             print $word . " ";
  17.         }
  18.     }
  19. }
  20. print "Changed words ($ARGV[1]): " . $counter . "\n";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement