[PLUG] PERL cgi scripting dumb question...
Jeme A Brelin
jeme at brelin.net
Fri Oct 24 23:55:02 UTC 2003
On Fri, 24 Oct 2003, Michael C. Robinson wrote:
> How in perl do I take a string like eagle.robinson-west.com and compare
> the domain part of it to another string?
Here's a kinda bonehead way to do it (too sleepy for clever):
@domainparts = split '.', $fqdn;
if ( $string_to_compare =~ m/$domainparts[-2]\.$domainparts[-1]/ ) {
print "It matches, motherfucker.\n";
} else {
print "It don't match, bitch.\n";
}
That should work, right? I have to sleep now.
This has been the strangest night ... ever.
J.
--
-----------------
Jeme A Brelin
jeme at brelin.net
-----------------
[cc] counter-copyright
http://www.openlaw.org
More information about the PLUG
mailing list