Perl에서이 eval
문에 오류가 있습니까? 나는 XML은 XML::LibXML와 파일의 구문 분석에서 던진 예외를 잡기로 유효한지 확인하기 위해 노력하고있어 :Perl에서이 eval 문이 잘못되었습니다.
use XML::LibXML;
my $parser = XML::LibXML->new(); #creates a new libXML object.
eval {
my $tree = $parser->parse_file($file) # parses the file contents into the new libXML object.
};
warn() if [email protected];
$ tree를 별도로 선언 할 필요는 없습니다. eval의 결과는 마지막 평가 결과입니다 : my $ tree = eval {...}. –