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 to count no of occurrence of a unique patterns in perl?

Answer Posted / ramya

while ($string =~ /<pattern>/g) { $count++ }

Is This Answer Correct ?    9 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

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

1019


What does the’$_’ symbol mean?

1052


Mention the difference between die and exit in Perl?

1171


What is the use of 'ne' operator?

1053


Explain cpan?

1024


What does `new $cur->{LINK}' do? (Assume the current package has no new() function of its own.)

985


What are the steps involved when the cgi program starts running?

965


When does circular reference occur?

964


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

989


explain the various functions/directives in perl that allow you to include/import a module. Also, state the differences between them.

921


How can we create perl programs in unix, windows nt, macintosh and os/2 ?

927


What is the difference between single (') and double (") quote in a string in perl?

1110


Explain join function in perl?

1001


package MYCALC; use Exporter; our @EXPORT = (); our @ISA = qw(Exporter); our @EXPORT_OK = qw(addition multi); our %EXPORT_TAGS = (DEFAULT => [qw(&addition)],Both => [qw(&addition & +multi)]); sub addition { return $_[0] + $_[1]; } sub multi { return $_[0] * $_[1]; } 1; Program: use strict; use warnings; my @list = qw (2 2); use Module qw(:DEFAULT); print addition(@list),"\n"; Above coding is my module MYCALC and the program which using this module, I have not exported any function using @EXPORT, but I have used the DEFAULT in %EXPORT_TAGS with the function addition, when I call this function from the main it says the error as,

2733


Can we load binary extension dynamically?

999