http://www.perlmonks.org?node_id=81448


in reply to Re: Re: Re: Re: Fastest way to compare multiple variables?
in thread Fastest way to compare multiple variables?

I too couldn't resist. A single walk through the hash's keys is the fastest way I could think of doing this:

sub dkubb_compare { my $data = shift; my $first = @{$data{scalar each %$data}}; while(my $key = scalar each %$data) { return 0 unless $first == @{$data{$key}}; } return 1; }

IMHO, it's a little too obscure to be used in production code, but I think it still is a neat idiom.