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
How can I display all array element in which each element will display on next line in perl ?
Explain subroutine in perl?
What are the logical operators used for small scale operations? Explain them briefly.
Create a function that is only available inside the scope where it is defined ?
What are scalar data and scalar variables?
What can be done for efficient parameter passing in perl? Explain.
What is the difference between die and exit in perl?
How to know whether a key exists or not in perl?
Explain a tell function in perl?
What happens in dereferencing?
what are the steps involved in reading a cgi script on the server?
How do I read command-line arguments with Perl?
Explain strftime() function in perl?
What is boolean context?
What is -> symbol in perl?