从文件中读取问题 [英] Problem Reading From File

查看:75
本文介绍了从文件中读取问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好......

我最近开始学习perl .....并且当我尝试从另一个文件读取输入时遇到问题。我试图运行的脚本的详细信息如下:


i制作了一个名为text.txt的文本文件,其内容为

Sidra | 38 | BE

Hira | 48 | BE

Shagufta | 50 | BE


然后我编写了以下脚本

hello...
i have recently started learning perl.....and having issues when i try to read input from another file. the details of a script that i tried to run are as follows:

i made a text file by the name “text.txt” and the contents were
Sidra|38|BE
Hira|48|BE
Shagufta|50|BE

Then i wrote the following script

展开 | 选择 | Wrap | 行号

推荐答案

我最近开始学习perl。我在从文件中读取输入时遇到问题。请帮我解决这个问题。脚本的详细信息如下:


i制作了一个名为text.txt的文本文件,内容为


Sidra | 38 | BE

Hira | 48 | BE

Shagufta | 50 | BE


然后我编写了以下脚本
i have recently started learning perl. I am having a problem while reading input from a file. Kindly help me out to resolve this issue. The details of the script are as follows:

i made a text file by the name “text.txt” and the contents were

Sidra|38|BE
Hira|48|BE
Shagufta|50|BE

Then i wrote the following script
展开 | 选择 | Wrap | 行号


Sidra,


您的帖子有些问题,但是一个人为你赢得了一次警告。那个问题是你在这个论坛上劫持了一个帖子。如果您有疑问,绝对将该问题作为某人的一部分提出。这称为劫持,违反了本论坛的规则和准则。这是你唯一的警告,下次将导致临时禁令。


我对你的帖子唯一的另一个问题是你在帖子中放置的代码中缺少代码标签。请根据需要使用它们。


问候,


杰夫
Sidra,

There were a couple things wrong with your post, but one has earned you a one time warning. That issue is that you hijacked a thread on this forum. If you have a question, you absolutely do not ask that question as part of someone elses thread. That is called hijacking and is against the rules and guidelines of this forum. This is your one and only warning against this and next time will result in a temporary ban.

The only other issue I had with your post was your lack of code tags use around the code you put in your post. Please use them as they are required.

Regards,

Jeff


请使用代码发布代码时的标签。


您应该始终检查公开呼叫的返回代码以验证是否成功并在失败时采取措施。最好使用3 arg形式的open和lexical var作为文件句柄而不是裸字。


每个Perl脚本应包含这2个pragma。
Please use the code tags when posting code.

You should ALWAYS check the return code of an open call to verify that is was successful and take action if it failed. It is better to use the 3 arg form of open and a lexical var for the filehandle instead of a bareword.

Every Perl script should include these 2 pragmas.
展开 | 选择 | Wrap | 行号


这篇关于从文件中读取问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆