Write a simple regular expression to match an IP address,
e-mail address, city-state-zipcode combination.
Answer Posted / jayakumar.b
sub validate_ip {
my $ip = shift;
if ( $ip =~ m/^([1-9]|1[0-9]{1,2}|2[0-4]\d|25[0-5])(\.([0-9]|1[0-9]{1,2}|2[0-4]\d|25[0-5])){3}$/ ) {
return 0;
} else {
return 1;
}
}
validate_ip("127.0.0.1");
| Is This Answer Correct ? | 4 Yes | 3 No |
Post New Answer View All Answers
What is qq (double q)operator in perl?
What are the various file operations in perl. Explain with example.
Remove the duplicate data from @array=(“perl”,”php”,”perl”,”asp”)
What is the main function of cookie server?
How to create a directory in perl?
What does this symbol mean '->'?
Explain the meaning of closure in perl.
What exactly is grooving and shortening of the array?
Explain grooving and shortening of arrays?
You want to open and read data files with perl. How would you do that?
What is subroutine in perl?
Elaborate on perl bite-wise operators.
Explain a tell function in perl?
Mention how many ways you can express string in Perl?
There is no strict data types in perl unlike in other high level languages like Java so wouldn't that be a problem if a code in perl is to be a written by a big team of 20+ members ?"