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.
In reply to (dkubb) Re: (5) Fastest way to compare multiple variables?
by dkubb
in thread Fastest way to compare multiple variables?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |