Greetings monks!
This is somewhat RE voodoo, and while I'm fair with sed,
and a bit grepish. I don't feel confident enough to subject my understandings to the internet at large -- I'm working with form fields that will be in a web page.
That said;
I have built a couple of functions that return either domain information, or IP information. While I could simply use a select form field, or a radio/checkbox. I was hoping to simply consolidate, and use the single text field, and based on the content, direct it to the proper function.
So my conditionals are:
1.) is a valid domain name
2.) is an IP address
So I can imagine that the easiest, perhaps even the most efficient, might be to simply grep against an IP;
if (!$input) {print $form;
}else{
if $input (d.d.d.d) $input=>$ip;
}else{
if $input (valid.domain.name) $input=>$domain;
}else{
print $form;
}
I realize the above is
quite simplistic. But I'm afraid I really need some help in this area. What would be good logic to grep patterns correctly to arrive at a efficient conditional?
Thank you very much for all your consideration, and my sincere apologies if this seems a stupid question.
--chris
#!/usr/bin/perl -Tw
use perl::always;
my $perl_version = "5.12.5";
print $perl_version;
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.