如何一次一行地从哈希表中打印文本文件 [英] How to print text file from hash table one line at a time

查看:46
本文介绍了如何一次一行地从哈希表中打印文本文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在尝试弄清楚如何一次一行地从哈希表中打印文本文件时遇到了困难。我将文本文件读入哈希表并可以一次打印文本文件,但我似乎无法弄清楚如何一次一行。


以下是我要做的事情:我希望用户能够通过单击按钮查看下一行,一次打印一行文本文件。


示例:如果text_file1第一行是line1而第二行是line2,我想在用户单击提交按钮时打印line1然后再次单击它时将打印line2。任何帮助,将不胜感激。如果您需要更多信息或解释,请询问。

I''m having difficulty trying to figure out how to print a text file from a hash table one line at a time. I have the text file read into the hash table and can print the text file all at once, but I can''t seem to figure out how to do it one line at a time.

Here is what I''m trying to do: I want the user to be able to print the text file one line at a time by clicking a button to see the next line.

Example: If text_file1 first line is line1 and the second line is line2, I want line1 to print when the user clicks the submit button then when they click it again line2 will be printed. Any help would be appreciated. If you need more information or an explanation please ask.

展开 | 选择 | Wrap | 行号

推荐答案

和你一起想在CGI脚本中这样做?首先要纠正所有语法错误。这是一个:

And you want to do this in a CGI script? First thing is to correct all syntax errors. Here is one:

展开 | 选择 | Wrap | 行号


对不起,我在复制和粘贴时必须复制该行两次它。第35行不应该在那里。我认为'这是唯一的错误那是在那里。我没有收到任何错误消息。
Sorry, I must have copied that line twice when I was copying and pasting it. Line 35 isn''t supposed to be there. I think that''s the only "error" that was in there. I wasn''t getting any error messages.


@ JWest46088


行可能不存在,凯文指的是语法,这很重要。除非你说出来,Perl并不总是抱怨一切。因此,在代码的第一行之后:

@JWest46088
While that line may not have been there, Kevin is referring to syntax, which is important. Unless you tell it, Perl won''t always complain about everything. So, right after the first line in your code put:

展开 | 选择 | Wrap | 行号


这篇关于如何一次一行地从哈希表中打印文本文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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