Jul 5, 2000, 4:37 PM
Post #2 of 3
<BLOCKQUOTE><font size="1" face="Arial,Helvetica,sans serif">code:</font><HR>
Re: delete to end of string (beginner Q)
[In reply to]
$url = 'http://www.perlarchive.com/tlc/index.shtml';
$url =~ s<^http://www\.(.*?)\.com/.*><$1>;</pre><HR></BLOCKQUOTE>
...does what you asked for.
However, there are many, many URLs that such a substitution would be useless for such as http://www.perl.org/, http://perlguru.com/, http://18.104.22.168/, or something really wacky like http://http://www.to/ (and, yes, those all really do work).
Consider yourself warned!