How can I use Perl extract a particular column from a tab-separated file?

前端 未结 4 1065
灰色年华
灰色年华 2020-12-12 05:57

I am really new at Perl and have been trying to piece together a solution for this. When I run this program I don\'t get any errors and it doesn\'t display anything.

4条回答
  •  情歌与酒
    2020-12-12 06:35

    The reason you don't get any errors is because your program does exactly what you told it to (print all first column values that contain the string "Ball"). Since none of the cells in the first column contain that string, your program prints nothing.

    Your problem is not with your Perl (it could use some minor stylistic improvement - specifically you're using obsolete form of open() - but is mostly fine), it's with your algorithm.

    HINT: your first task in the algorithm should be finding WHICH column (by number) is the "Ball" column.

提交回复
热议问题