Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cowens/134170 to your computer and use it in GitHub Desktop.
Save cowens/134170 to your computer and use it in GitHub Desktop.
#!/usr/bin/perl
use strict;
use warnings;
my @results = (0, 1, 0, 0, 1);
my $i = 0;
my %h;
for my $key (qw/a a b c b/) {
my $bool = exists $h{$key} ? 1 : ($h{$key} = 0);
print $bool == $results[$i++] ? "good" : "bad", "\n";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment