Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Illegal declaration of subroutine Error

by Khen1950fx (Canon)
on Dec 01, 2013 at 09:53 UTC ( #1065132=note: print w/ replies, xml ) Need Help??


in reply to Illegal declaration of subroutine Error

The first thing to do when you start a script is use strictures:

#!/usr/bin/perl use strict; use warnings;
When you finish the script, run it through Perl::Tidy:
#!/usr/bin/perl -l use strict; use warnings; my (@gilligan) = qw( red_shirt hat lucky_socks water_bottle ); check_require_items( 'gilligan', @gilligan ); sub check_require_items { use strict; use warnings; my $who = shift(); my (%whos_items) = map( { $_, 1; } @_ ); my (@required) = qw( preserver sunscreen water_bottle jacket ); foreach my $item (@required) { unless ( $whos_items{$item} ) { print "$who is missing $item."; } } }
It's easier to read, no?


Comment on Re: Illegal declaration of subroutine Error
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1065132]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (6)
As of 2015-07-04 19:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (60 votes), past polls