#!/usr/bin/perl
use Mojo::Base -strict;
use Mojo::DOM;
use Mojo::Util qw(decode);
use Mojo::UserAgent;
my $uri = 'http://efremova.info/word/statja.html';
my $sel = 'td#centerCnt ol li';
my $charset = 'windows-1251';
my $tx = Mojo::UserAgent->new()->get($uri);
my $res->headers->content_type("text/html; charset=$charset");
my $dom = $res->dom;
my $el = $dom->at($sel) or die "selector $sel not found";
$el->find('span.nobr')->each(sub { $_->replace($_->text) });
my $text = $el->text;
binmode(STDOUT, ':encoding(UTF-8)');
得到错误:无法在 search.pl 第 10 行的未定义值上调用方法“标题”。
我应该怎么办?
非常感谢