I am trying to count all the definite articles and indefinite articles. And change "the"=>"THE", "a"=>"A", "an"=>"AN".
Obviously, a lot of errors in my codes.
Hopfully, to get help
perl test.pl test.txt
Code:
use English;
my $def_count; # the number of definite articles
my $indef_count; #the number of indefinite articles
sub count {
if ( $ARG[0] =~ /the/) #count as true if the lowercase version of the only argument of count is equal to "the"
{
$def_count++;
}
else  {
  $indef_count++;
}
return /uc($ARG[0])/; # return the uppercase version of the only argument of count.
}
while (<>) {
s/b\([Tt]he|a|an)\b/uc($1)/
#output the line here,but how to do it
}
print "\nThere were $def_count definite articles\n",
"and $indef_count indefinite articles in the text.\n";
Thanks