How would you replace a char in string and how do you store
the number of replacements?
Answer Posted / ananth_s
#!usr/bin/perl
use strict;
use warnings;
my $string="XmanXseriesx";
my $count = ($string =~ tr/X//);
print "There are $count Xs in the string\n";
print $string;
| Is This Answer Correct ? | 7 Yes | 1 No |
Post New Answer View All Answers
How are parameters passed to subroutines in perl?
Explain cpan?
Explain arrays in perl.
Who created perl?
Explain the difference between declarations of 'my' and 'local' variable scope in perl?
Can we load binary extension dynamically?
What are the steps involved when the cgi program starts running?
Explain grooving and shortening of arrays and splicing of arrays?
Which has the highest precedence, List or Terms? Explain?
Comment on array slicing and range operator
How do I sort a hash by the hash key?
Explain what is perl language?
What are the advantages of perl programming?
What is 'rollback' command in perl?
How to prevent file truncation in perl?