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

Explain regular expression in perl?

527


How to disable the mod_perl from apache_server as i have used perlfect search on the site and its pagination is not working and the remedy is to disable the mod_perl.

1788


What are the two ways to get private values inside a subroutine?

450


Explain the use of 'my' keyword in perl?

559


In CPAN module, name an instance you use.

540






What is the difference between perl list and perl array?

464


What is perl unshift array function?

515


What is perl pop array function?

534


What are scalars?

545


Explain about typeglobs?

551


What rules must be followed by modules in perl.

565


How to replace perl array elements?

524


How many ways can we express string in Perl?

538


Explain lexical variables.

515


How to determine strings length in perl?

530