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
What is “grep” function in perl?
What is the difference between perl array and perl hash?
What is use of ‘->’ symbol?
Is perl compiler or interpreter?
How to close a file in perl?
Why do we use "use strict" in perl?
What are the various uses of perl?
Which has the highest precedence, List or Terms? Explain?
What are the reasons that cookie server can’t handle multiple connections?
What are the different string manipulation operators in perl?
What's the difference between /^Foo/s and /^Foo/?
How does a “grep” function perform?
If you want to empty an array then how would you do that?
What does the q{ } operator do?
How do I pass a command line argument in perl?