我有这个perl代码:
#!/usr/bin/perl
use warnings;
use strict;
require WWW::Mechanize;
my $baseurl = $ARGV[0];
my $mech;
$mech = WWW::Mechanize->new();
$mech->get($baseurl);
my @links = mech->links();
foreach my $link (@links) {
print "link->url\n";
}
我收到错误:
Can't locate object method "links" via package "mech" (perhaps you forgot to load "mech"?) at ./so.pl line 13.
我很难过;这绝对是CPAN的课程定义。
答案 0 :(得分:1)
您错过了$
:
my @links = $mech->links();