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?

Answers were Sorted based on User's Feedback



How would you replace a char in string and how do you store the number of replacements? ..

Answer / 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

How would you replace a char in string and how do you store the number of replacements? ..

Answer / ananth_s

#!usr/bin/perl
use strict;
use warnings;
my $string="XmanXseriesx";
my $count = ($string =~ tr/X//);
print "There are $count Xs in the string\n";
print $string;

Is This Answer Correct ?    7 Yes 1 No

Post New Answer

More CGI Perl Interview Questions

What is the difference between die and exit in perl?

0 Answers   HCL,


Explain lists in perl?

0 Answers  


Which feature of perl provides code reusability?

0 Answers  


How would you ensure the re-use and maximum readability of your perl code?

0 Answers  


What is the purpose of redo statement?

0 Answers  


how to connect cisco switch uisng perl script

0 Answers   ABC,


In Perl, what is grep function used for?

0 Answers  


Which feature of Perl provides code reusability ? Give any example of that feature.

1 Answers  


Can you add two arrays together?

0 Answers  


How do you match one letter in the current locale?

0 Answers  


What is v-strings?

0 Answers  


What is the purpose of goto expr statement?

0 Answers  


Categories