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
What does next statement do in perl?
How does polymorphism work in perl? Give an example.
Explain the execution of a program in perl.
How to open and read data files with Perl
What are the advantages of c over Perl?
What does 'do' statement do in perl?
Explain split function in perl?
What are scalars in perl?
How to read a file into a hash array?
What is goto statement in perl?
you are required to replace a char in a string and store the number of replacements. How would you do that?
How to close a file in perl?
There are some duplicate entries in an array and you want to remove them. How would you do that?
How do I generate a list of all .html files in a directory?
In Perl, there are some arguments that are used frequently. What are that arguments and what do they mean?