SPUG: better way?
Nathan Lewis
nathan at n2h2.com
Tue Aug 10 15:39:32 CDT 1999
You could reduce the number of lines of code by using regex pattern
matching.
my $re = referer();
$re =~ m|//([^/]*)|;
print $1,"\n";
I don't know if that's better. BTW, is <HACK> </HACK> a new pair of XML
tags you're defining ;-)
Nathan
On Mon, 9 Aug 1999, Sean Ruddy wrote:
> Better way to get just the domain from referer?
> I think this code will show my newbieness (but it works...)
> <HACK>
> my $re = referer();
> my $doubleslash = rindex($re,'//');
> my $headslash = substr($re,$doubleslash+2);
> my $domslash = index($headslash,'/');
> print substr($headslash,0,$domslash);
> </HACK>
>
> Thanks,
> Sean
>
>
> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
> Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
> SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
> Email to majordomo at pm.org: ACTION spug-list your_address
>
>
>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
SUBSCRIBE/UNSUBSCRIBE: Replace ACTION below by subscribe or unsubscribe
Email to majordomo at pm.org: ACTION spug-list your_address
More information about the spug-list
mailing list