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

Answer Posted / rajendran

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

Is This Answer Correct ?    10 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to determine strings length in perl?

530


What is perl programming?

551


Define say() function in perl?

535


Explain what is STDIN, STDOUT and STDERR?

539


what is the function of Return Value?

561






What is perl dbi?

493


Explain the meaning of closure in perl.

524


Which guidelines by Perl modules must be followed?

565


Explain the difference between "my" and "local" variable scope declarations. ?

561


What is stdin in perl?

540


How do I send e-mail from a Perl/CGI program on a Unix system?

586


What can be done for efficient parameter passing in perl?

473


How to copy a file in perl?

510


What is boolean context?

546


How many types of variable in perl?

551