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 a chomp() function in perl?

1106


What is the difference between perl array and perl hash?

1177


Which functions in perl allows you to include a module file.

1106


Explain USE and REQUIREMENT statements?

982


What are the various uses of perl?

1095


Explain what is perl language?

980


Explain chomp, chop, cpan, tk.

996


What is an interpolation in perl?

1045


What is use of ‘->’ symbol?

1058


Differentiate use and require?

1004


Explain the meaning of perl one-liner?

1116


What are perl strings?

945


Explain lists in perl?

1022


How to find the length of an array in perl?

1062


How do I debug a perl program?

1031