我正在使用下面的代碼來獲取網頁內容。它工作正常,但我想要獲得特定的線路。任何幫助是極大的讚賞。如何只從Perl中的網頁內容中獲取特定行
use strict;
use warnings;
use LWP::Simple;
my $content = get('http://www.w3schools.com/');
print $content;
my @arr;
my $flag = 0;
push (@arr, $content);
#print @arr;
my $find = "HTML 4.01";
for (@arr)
{
if ($_ =~ /$find/)
{
print "$_\n";
print "passed\n";
$flag = 1;
}
}
if ($flag == 1)
{
print "Testcase passed";
}
else
{
die "Testcases fails";
}
my $ flag = $ content =〜/ $ find/i; – cdtits 2012-08-08 07:24:34