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

Demonstrate subroutines in perl with a simple example.

815


What are the different string manipulation operators in perl?

863


Write an example explaining the use of symbol tables.

901


What do you mean by context of a subroutine?

919


What is a chop() function in perl?

949


How to remove a directory in perl?

910


What are arrays in perl?

916


In Perl, what is grep function used for?

1007


How do I pass a command line argument in perl?

918


How will you create a file in perl?

914


Explain regular expression in perl?

892


What are the functions that can be performed using cgi program?

846


You want to print the contents of an entire array. How would you do that?

890


Explain grooving and shortening of arrays?

1026


How to open a directory in perl?

1026