Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is the use of -t?

931


What are the various flags/arguments that can be used while executing a perl program?

845


How can I display all array element in which each element will display on next line in perl ?

899


What is the function of cgiwrap in cgi programming?

891


There are some duplicate entries in an array and you want to remove them. How would you do that?

883


What is -> symbol in perl?

976


What are scalars?

964


Explain subroutine?

885


How to read a file into a hash array?

1022


Why should I use the -w argument with my Perl programs?

935


Can inheritance be used in perl? Explain with the help of an example.

937


Explain perl one-liner?

928


Explain grooving and shortening of arrays?

1053


You want to read command-line arguements with perl. How would you do that?

875


What are the advantages of perl programming?

967