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
What are the benefits of perl in using it as a web-based application?
What is use of ‘->’ symbol?
Explain about the applications of perl?
Explain perl. What are the advantages of programming in perl?
How can I implement the function overloading in Perl ? I read about the operator overloading, I do not know how to implement the function overloading. Thanks in advance ?
Differences between die and exit.
How do you turn on the perl warnings?
What is the difference between single (') and double (") quote in a string in perl?
How does a “grep” function perform?
Explain gmtime() function in perl?
How we can navigate the xml documents?
What are the advantages of perl programming?
Explain the functioning of conditional structures in perl.
Explain the difference between die and exit in perl?
package MYCALC; use Exporter; our @EXPORT = (); our @ISA = qw(Exporter); our @EXPORT_OK = qw(addition multi); our %EXPORT_TAGS = (DEFAULT => [qw(&addition)],Both => [qw(&addition & +multi)]); sub addition { return $_[0] + $_[1]; } sub multi { return $_[0] * $_[1]; } 1; Program: use strict; use warnings; my @list = qw (2 2); use Module qw(:DEFAULT); print addition(@list),"\n"; Above coding is my module MYCALC and the program which using this module, I have not exported any function using @EXPORT, but I have used the DEFAULT in %EXPORT_TAGS with the function addition, when I call this function from the main it says the error as,