How would you replace a char in string and how do you store
the number of replacements?
Answer Posted / tanu
$str='Hello';
$cnt= ($str=~s/l/i/g);
print $cnt;
$cnt stores the number of replacements.
| Is This Answer Correct ? | 20 Yes | 4 No |
Post New Answer View All Answers
What is the use of -t?
What are the various flags/arguments that can be used while executing a perl program?
How can I display all array element in which each element will display on next line in perl ?
What is the function of cgiwrap in cgi programming?
There are some duplicate entries in an array and you want to remove them. How would you do that?
What is -> symbol in perl?
What are scalars?
Explain subroutine?
How to read a file into a hash array?
Why should I use the -w argument with my Perl programs?
Can inheritance be used in perl? Explain with the help of an example.
Explain perl one-liner?
Explain grooving and shortening of arrays?
You want to read command-line arguements with perl. How would you do that?
What are the advantages of perl programming?