I cant seem to understand the reason for these syntax errors. The following is part of my code. I have strict and warnings implemented.
my $res = $s->scrape(URI->new($urlToScrape));
#warn Dump $res;
print "Show :".$res->{showtitle}[0];
my @sct;
if ( defined {season}[0] ) {
print $res->{season}[0];
@sct=split(' ', $res->{season}[0]);
} else {
my @spaa=split( {showtitle}[0], {fulltitle}[0] );
print "Couldnt find season num at proper position\n";
print $spaa[0]."\n";
print $spaa[1]."\n";
exit;
}
The error I get is:
$ ./htmlscrape.pl
"my" variable @spaa masks earlier declaration in same scope at ./htmlscrape.pl line 43.
"my" variable @spaa masks earlier declaration in same scope at ./htmlscrape.pl line 44.
syntax error at ./htmlscrape.pl line 37, near "}["
syntax error at ./htmlscrape.pl line 40, near "}"
syntax error at ./htmlscrape.pl line 46, near "}"
Execution of ./htmlscrape.pl aborted due to compilation errors.
@spaasomewhere else. - Maurice Reevesdefined {season}[0]bedefined $res->{season}[0]? - Keith Thompson{showtitle}[0], {fulltitle}[0]- TLP