나는 특정 태그에서 텍스트를 검색 할 수있는 조건이 있지만 true 반환하는 것 같지 않습니다? 어떤 도움이?왜이 조건이 작동하지 않습니까? Div 함께 클래스
#!/usr/bin/perl
use HTML::TreeBuilder;
use warnings;
use strict;
my $URL = "http://prospectus.ulster.ac.uk/modules/index/index/selCampus/JN/selProgramme/2132/hModuleCode/COM137";
my $tree = HTML::TreeBuilder->new_from_content($URL);
if (my $div = $tree->look_down(_tag => "div ", class => "col col60 moduledetail")) {
printf $div->as_text();
print "test";
open (FILE, '>mytest.txt');
print FILE $div;
close (FILE);
}
print $tree->look_down(_tag => "th", class => "moduleCode")->as_text();
$tree->delete();
그것은 if 문으로 들어갈되지 않고 if 문 외부에 인쇄가 정의되지 않은 값이 있음을 말하고있다,하지만 난이 태그가 존재하기 때문에 그것이 사실 반환되어야한다는 것을 알고있다.
<th class="moduleCode">COM137<small>CRN: 33413</small></th>
감사
@downvoter :이 질문에 무엇이 잘못 되었습니까? – Borodin