SPUG: better way?

Sean Ruddy sean at DigiDot.com
Tue Aug 10 16:56:52 CDT 1999


Thanks all!
That's more what I was looking for.  Obviously I need to reread the regex
chapter.

Yes a new XML DTD will be coming to a web server near you for HACK, KLUGE,
RANT...

Sean

Nathan Lewis wrote:

> 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