catfish1116 has asked for the wisdom of the Perl Monks concerning the following question:
I have a small program that is outputs the exact opposite of what I would expect
my @required = qw(preserver sunscreen water_bottle jacket); my %skipper = map { $_, 1} qw(blue_shirt hat jacket preserver sunscreen); foreach my $item (@required) { unless ( $skipper {item} ) { # not found in list? print "Skipper is missing $item, \n"; } }
This is my output Skipper is missing preserver, Skipper is missing sunscreen, Skipper is missing water_bottle, Skipper is missing jacket, How could that be flagged as missing if it is included in hash? TIA, The Catfish
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: map question
by toolic (Bishop) on Jul 26, 2019 at 16:54 UTC | |
Re: map question (hash slice)
by LanX (Saint) on Jul 26, 2019 at 19:25 UTC | |
by AnomalousMonk (Archbishop) on Jul 29, 2019 at 13:38 UTC | |
by LanX (Saint) on Jul 29, 2019 at 14:30 UTC | |
by ikegami (Patriarch) on Jul 29, 2019 at 03:19 UTC | |
by LanX (Saint) on Jul 29, 2019 at 03:35 UTC | |
by ikegami (Patriarch) on Jul 29, 2019 at 05:51 UTC | |
by LanX (Saint) on Jul 30, 2019 at 12:21 UTC | |
| |
by LanX (Saint) on Jul 30, 2019 at 00:50 UTC | |
Re: map question
by stevieb (Canon) on Jul 26, 2019 at 16:57 UTC |