I copied the following code straight from the "Learning Perl" book by Randal L. Schwartz. But I keep getting the following message: " Illegal declaration of subroutine main::check_required at c:\chapter 4\isametask3.pl line 12. Can someone solve this? thank you,
use 5.012;
my @gilligan=qw(red_shirt hat lucky_socks water_bottle);
&check_required items ("gilligan",@gilligan);
sub check_required items {
$who=shift;
%whos_items=map {$_,1} @_;
@required=qw(preserver sunscreen water_bottle jacket);
for my $item(@required){
unless($whos_items{$item}){
print "$who is missing $item.\n";
}
}
}