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 are the reasons that cookie server can’t handle multiple connections?
What is goto statement in perl?
What is perl push array function?
you are required to replace a char in a string and store the number of replacements. How would you do that?
how to get back up from private character editor which is saved in the format of .udf
How and what are closures implemented in perl?
Demonstrate subroutines in perl with a simple example.
Explain the difference between "my" and "local" variable scope declarations. ?
You want to print the contents of an entire array. How would you do that?
Perl regular expressions are greedy" what does this mean?
When do you use perl programming?
What is perl pop array function?
I have one question regarding to eval function. I know eval function is use for error checking but I am not able to understand below line. eval \'exec perl -S $0 ${1+\"$@\"}\' if 0; $0 for script name $@ set if error occur
What is the usage of -i and 0s options?
Explain gmtime() function in perl?