use strict; use warnings; use Data::Dump qw/pp dd/; my @lines =; my @headings = grep /^\s*AUID/, @lines; @headings = split ' ', $headings[0]; shift @headings; pp @headings; __DATA__ AUID \cIRA \cIDec \cILabel \cIV \cIB-V \cIComments AUID \cIRA \cIDec \cILabel \cIV \cIB-V \cIComments AUID \cIRA \cIDec \cILabel \cIV \cIB-V \cIComments