Write a script for 'count the no.of digits using regular
expressions in perl..
Answer Posted / 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 |
Post New Answer View All Answers
When does circular reference occur?
What is a chop() function in perl?
Why we use CGI?
Enlist the advantages of using c over perl?
What is posix 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,
What is hash?
Explain cpan?
Explain grooving and shortening of arrays?
What is perl pop array function?
What are perl array functions?
How we can navigate the xml documents?
What are the benefits of perl in using it as a web-based application?
Demonstrate subroutines in perl with a simple example.
How can you call a subroutine and identify a subroutine?