use strict; my @a = qw(a a a a a a a); my @b = qw(a a a a a a Q); my @c = qw(a a a M a a a); my @d = qw(Z a a c a a a); sub all_eq { my $first = shift; for (@_) { next if ($first eq $_); return 0; } return 1; } map { printf "testing @$_: -> %d\n", all_eq(@$_) } (\@a, \@b, \@c, \@ +d);
In reply to Golf Challenge: all elements of an array equal by princepawn
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |