What's the best way to open and read a file in Perl?

前端 未结 12 1982
醉话见心
醉话见心 2020-11-27 13:11

Please note - I am not looking for the \"right\" way to open/read a file, or the way I should open/read a file every single time. I am just interested to find out what way m

12条回答
  •  执念已碎
    2020-11-27 13:27

    There is no best way to open and read a file. It's the wrong question to ask. What's in the file? How much data do you need at any point? Do you need all of the data at once? What do you need to do with the data? You need to figure those out before you think about how you need to open and read the file.

    Is anything that you are doing now causing you problems? If not, don't you have better problems to solve? :)

    Most of your question is merely syntax, and that's all answered in the Perl documentation (especially (perlopentut). You might also like to pick up Learning Perl, which answers most of the problems you have in your question.

    Good luck, :)

提交回复
热议问题