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 you create anonymous subroutines?
What is perl pop array function?
How to deleting an existing file in perl programming?
What is the difference between use and require in perl programming?
How to read a directory in perl?
What are arrays in perl?
How can you use Perl warnings and what is the importance to use them?
How to sort arrays in perl?
How to disable the mod_perl from apache_server as i have used perlfect search on the site and its pagination is not working and the remedy is to disable the mod_perl.
What are the steps involved when the cgi program starts running?
How to renaming a file in perl programming?
What does a die() function do in perl?
Why Perl aliases are considered to be faster than references?
What are perl array functions?
How do you give functions private variables that retain their values between calls?