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 happens to objects lost in "unreachable" memory, such as the object returned by Ob->new() in `{ my $ap; $ap = [ Ob->new(), $ap ]; }' ?
Explain different types of perl operators.
What is the function of virtual documents in cgi programs?
What does the qq{ } operator do?
What is cpan in perl?
Mention what is cpan?
Explain the use of 'my' keyword in perl?
What are the different types of perl operators?
What is the difference between localtime() and gmtime() functions?
Write a program to download the contents from www.perlinterview.com/answers.php website in Perl.
What is the difference between use and require in perl programming?
what are prefix dereferencer and list them out?
How to merge two arrays in perl?
How do you give functions private variables that retain their values between calls?
Which has highest precedence in between list and terms? Explain?