Given a matrix stored as a tab-delimited file with row + col headers, the upper left entry is often blank (a single tab):
A B C D E
A 1 1 1 1 1
B 1 1 1 1 1
C 1 1 1 1 1
D 1 1 1 1 1
E 1 1 1 1 1
I wish to be able to access and modify this entry. Ordinarily to access a specific element I would use something like:
perl -lanse 'print $F[$j-1] if $. == $i' -- -i=1 -j=1
However this prints 'A' and does not recognise the initial tab as counting as an element. Is there a way to print something into this first element? For example producing:
ID A B C D E
A 1 1 1 1 1
B 1 1 1 1 1
C 1 1 1 1 1
D 1 1 1 1 1
E 1 1 1 1 1