#!/usr/bin/perl my $a = 2; my $b = 2; my @arr = qw( 2 2 2 ); if (all_equal_ints($a, $b, @arr)) { print "They're all equal!\n" } else { print "They're not all equal!\n"; } sub all_equal_ints { my $first = shift; for (@_) { return 0 unless $first == $_; } return 1; }
In reply to Re: Fastest way to compare multiple variables?
by runrig
in thread Fastest way to compare multiple variables?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |