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 many types of operators are used in the Perl?

578


Can we load binary extension dynamically?

577


Explain the default scope of variables in perl?

510


Explain perl. When do you use perl for programming?

446


What are scalar data and scalar variables?

636






What is the main function of cookie server?

525


How does polymorphism work in perl? Give an example.

479


What $! In perl?

527


How to close a file in perl?

487


Explain perl one-liner?

514


Explain string comparison operators in perl.

552


I have one question regarding to eval function. I know eval function is use for error checking but I am not able to understand below line. eval \'exec perl -S $0 ${1+\"$@\"}\' if 0; $0 for script name $@ set if error occur

1606


Mention what is cpan?

574


What does delete function do in perl?

518


How to add elements in a hash in perl?

510