0 votes
in Perl by
How can you replace the characters from a string and save the number of replacements?

1 Answer

0 votes
by

#!usr/bin/perl

use strict;

use warnings;

my $string="APerlAReplAFunction";

my $counter = ($string =~ tr/A//);

print "There are $counter As in the given string\n";

print $string;

...