use constant { CONTENT_TYPE => 0, DOCUMENT_LENGTH => 1, ... }; ... my @head_values = head(...); ... # later in the code far from the initialisation ... $head_values[DOCUMENT_LENGTH] ...