my @attributes = qw( head opinion result ); sub hashify { my $self = shift; return { map { $attributes[$_] => $self->[$_] } 0 .. $#$self } }