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 a chomp() function in perl?
What is the difference between perl array and perl hash?
Which functions in perl allows you to include a module file.
Explain USE and REQUIREMENT statements?
What are the various uses of perl?
Explain what is perl language?
Explain chomp, chop, cpan, tk.
What is an interpolation in perl?
What is use of ‘->’ symbol?
Differentiate use and require?
Explain the meaning of perl one-liner?
What are perl strings?
Explain lists in perl?
How to find the length of an array in perl?
How do I debug a perl program?