ZWcarp has asked for the wisdom of the Perl Monks concerning the following question:
Heres an example data input at the bottom, but the columns are always going to be in different order so I want a script to match the column header and then return the column number that that column header matched so I can set it equal to a variable and use it like this later print if $array[$variable] >15 (just and example)
Does anyone know the most efficient quick way to do something like this or is the only way to split the header into an array and looping through it for each variable you want to match and give a value? Thank you for your time!
Non-Syn Splice dbSNP N (Var Depth) N Total Depth N Freq + T (Var Depth) 1 0 0 0 34 0 11 1 0 0 0 54 0 14 1 0 0 0 42 0 11
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Shortcut to identify column numbers in a data file based on header
by tobyink (Canon) on Mar 27, 2012 at 19:53 UTC | |
|
Re: Shortcut to identify column numbers in a data file based on header
by jandrew (Chaplain) on Mar 27, 2012 at 18:25 UTC |