#! perl use strict; use warnings; use Benchmark qw( cmpthese ); use constant LABEL_ARRAY => qw(Title Section Subsection Class Category Degree Attempt CountOfCounts); my @label_array = qw(Title Section Subsection Class Category Degree Attempt CountOfCounts); cmpthese( -1, { array => \&array, constant => \&constant } ); sub constant { my $sum = 0; $sum += length for LABEL_ARRAY; return $sum; } sub array { my $sum = 0; $sum += length for @label_array; return $sum; }