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
How to read a single line from a file in perl?
How to concatenate strings with perl?
When does circular reference occur?
What is the tk module?
What is the syntax used in Perl grep function?
Explain goto name?
What are the advantages of programming in perl?
What is epoch time in perl?
What is the difference between perl array and perl hash?
What are the arguments and what do they mean in perl programming?
Which statement has an initialization, condition check and increment expressions in its body? Write a syntax to use that statement.
Can you add two arrays together?
Which functions in perl allows you to include a module file.
Where the command line arguments are stored and if you want to read command-line arguments with Perl, how would you do that?
“Perl regular expressions match the longest string possible”. What is the name of this match?