Re: 從URL字串抓取hostname
※ 引述《deh3215 ()》之銘言:
: my $str="http://www.rhbrands.com/images/mat.php.htm";
: 要取出http://到/中間這段,即www.rhbrands.com
用 http://search.cpan.org/dist/URI/ 做。
use URI;
my $u = URI->new($str);
print $u->host;
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.113.235.132
討論串 (同標題文章)
Perl 近期熱門文章
PTT數位生活區 即時熱門文章