Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Write a script for 'count the no.of digits using regular
expressions in perl..

Answers were Sorted based on User's Feedback



Write a script for 'count the no.of digits using regular expressions in perl....

Answer / rajendran

($test,$number) = ("","");
$test = "12344tyyyyy456";
@test=split('',$test);
foreach(@test)
{
if ($_ =~ /\d/)
{$number++;
}
}
print $number;

Is This Answer Correct ?    10 Yes 3 No

Write a script for 'count the no.of digits using regular expressions in perl....

Answer / arun janardhanan

Simple guys here we go :-).........


#!/usr/bin/perl -w

use strict;
my($test,$number) = ("","");
$test = "12344tyyyyy456";
$number = ($test =~ tr/[0-9]/[0-9]/);
print "Number of digits in variable is :- $number ";
exit;

Is This Answer Correct ?    11 Yes 5 No

Write a script for 'count the no.of digits using regular expressions in perl....

Answer / santha

$testnumber='34535sssss24';
$numbercount=0;
while($testnumber=~m{\d}igs)
{
$numbercount++;
}
print "\n $numbercount";

Is This Answer Correct ?    3 Yes 2 No

Write a script for 'count the no.of digits using regular expressions in perl....

Answer / tclgeek

to find the count of no of digits using regular expression in TCL

set val "abbj68689kbj8798797"
set a [regexp {[a-z]+(\d+)[a-z]+(\d+)} $val val1 val2 val3]
if { $a == 1 } {
puts "matched pattern found are : $val2$val3"
puts "the number of digits are [expr [string length $val2] + [string length $val3]]"
} else {
puts "error"
}

Is This Answer Correct ?    0 Yes 0 No

Write a script for 'count the no.of digits using regular expressions in perl....

Answer / swdaer\zffgasdt

AEWT AWET
WEKLFJCM
w?E:,f
"W:lrc";E

Is This Answer Correct ?    2 Yes 5 No

Write a script for 'count the no.of digits using regular expressions in perl....

Answer / 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

More CGI Perl Interview Questions

Write a program that explains the symbolic table clearly.

0 Answers  


In Perl, there are some arguments that are used frequently. What are that arguments and what do they mean?

0 Answers  


What is the use of '>>' in perl?

0 Answers  


List the operator used in Perl?

0 Answers  


Explain what is lvalue?

0 Answers  


my @array=('data1','data2'); my @array1=('data1','data2'); my ($i,$k); $i=7; $k=7; while($i){ $array [++$#array] = 'ree'; $i--; print "@array"; } while($k){ push(@array1,'ree'); $k--; print "@array1"; } Are these two while loop are doing the same functionality ? What may be the difference?

1 Answers   A1 Technology,


How to check the status of airplane mode (enable/disable) in perl for Android mobile?

0 Answers  


What is perl push array function?

0 Answers  


How to connect to SQL server through Perl?

0 Answers  


What interface used in PERL to connect to database? How do you connect to database in Perl?

0 Answers  


Explain lists ?

0 Answers  


Which of these is a difference between Perl and C++ ?

0 Answers  


Categories