ostra has asked for the wisdom of the Perl Monks concerning the following question:
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"; } } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Illegal declaration of subroutine Error
by kcott (Archbishop) on Dec 01, 2013 at 02:18 UTC | |
Re: Illegal declaration of subroutine Error (no spaces in names)
by Anonymous Monk on Dec 01, 2013 at 02:03 UTC | |
Re: Illegal declaration of subroutine Error
by Khen1950fx (Canon) on Dec 01, 2013 at 09:53 UTC |