in reply to Shortcut to identify column numbers in a data file based on header

Looking for something like this?

use 5.010; my @headers = do { chomp($_ = <DATA>); split /\t/ }; while (<DATA>) { chomp; my %F; @F{@headers} = split /\t/; say $F{'N Total Depth'}; } __DATA__ 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
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
  • Comment on Re: Shortcut to identify column numbers in a data file based on header
  • Download Code