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
How to find the length of an array in perl?
What are the options that can be used to avoid logic errors in perl?
Define print() function in perl?
Assuming both a local($var) and a my($var) exist, what's the difference between ${var} and ${"var"}?
How to start perl in interactive mode?
Explain the difference between declarations of 'my' and 'local' variable scope in perl?
How does polymorphism work in perl?
What does perl do in linux?
How will you open a file in read-only mode in perl?
What is “grep” function in perl?
What are the functions that can be performed using cgi program?
What is the function of virtual documents in cgi programs?
What are the advantages of perl programming?
How do I replace every character in a file with a comma?
Which has the highest precedence, List or Terms? Explain?