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

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

1008


What is stdin in perl?

975


Difference between the variables in which chomp function work ?

1081


What syntax is used for grep() function?

1189


Which statement has an initialization, condition check and increment expressions in its body? Write a syntax to use that statement.

1033


How to change a directory in perl?

931


Explain split function in perl?

1005


Demonstrate subroutines in perl with a simple example.

869


“Perl regular expressions match the longest string possible”. What is the name of this match?

944


How to open a directory in perl?

1119


What are scalar data and scalar variables?

1127


What are the different instances used in cgi overhead?

989


Which has the highest precedence, List or Terms? Explain?

895


Define dynamic scoping.

899


How can memory be managed in Perl?

1064