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...

Write a script for 'count the no.of digits using regular
expressions in perl..

Answer Posted / anandan

#!/usr/bin/perl -w

use strict;
my($test,$number) = ("","");
@test = "12344tyyyyy456";
foreach(@test)
{
if ($_ =~ /\d/)
{$number++;
}
}
print $number;

Is This Answer Correct ?    5 Yes 15 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to read a single line from a file in perl?

935


How to concatenate strings with perl?

814


When does circular reference occur?

868


What is the tk module?

918


What is the syntax used in Perl grep function?

987


Explain goto name?

879


What are the advantages of programming in perl?

980


What is epoch time in perl?

892


What is the difference between perl array and perl hash?

996


What are the arguments and what do they mean in perl programming?

965


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

989


Can you add two arrays together?

874


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

930


Where the command line arguments are stored and if you want to read command-line arguments with Perl, how would you do that?

1050


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

909