I notice that you can output fields in arbitrary orders, and even output a given column more than once, and these are handy improvements over cut. But why stop there?
Minor nit-picks:
while (<STDIN>) { tr/\r\n//d; # even better than chomp! print join( "\t", ( split /\t/ )[@ARGV] ), "\n"; }
while(<STDIN>) { last if /\t/; } die "No tab-delimited fields found\n" unless ( /\t/ );
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |