<?xml version="1.0" encoding="windows-1252"?>
<node id="80763" title="Re: Fastest way to compare multiple variables?" created="2001-05-16 00:50:07" updated="2005-07-19 14:08:39">
<type id="11">
note</type>
<author id="31503">
runrig</author>
<data>
<field name="doctext">
'Fastest' depends on whether or not they ARE 'all equal' :)
&lt;code&gt;
#!/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;
}
&lt;/code&gt;</field>
<field name="root_node">
80620</field>
<field name="parent_node">
80620</field>
</data>
</node>
