#!/usr/bin/env perl -l use strict; use warnings; my @test_headers = ( [qw{Strand Type Pos Length Form Adjustment}], [qw{ID Strand Type Pos Length Form Adjustment}], [qw{Strand XXX Type Pos Length Form Adjustment}], [qw{Pos Type Length Strand Form Adjustment}], ); for (@test_headers) { my @headers = @$_; my %index_of; @index_of{@headers} = 0 .. $#headers; print "Headers: @headers"; print "Strand index: $index_of{Strand}"; print "Type index: $index_of{Type}"; print "Pos index: $index_of{Pos}"; }