【发布时间】:2018-01-16 10:30:49
【问题描述】:
我有以下文本文件
Hello my
name is
Jeff
我想用 perl 打开它。但是,当使用此代码时
use strict;
use warnings;
open(my $fh, "<", "input.txt") or die "cannot open input text!";
my $text= <$fh>;
print $text;
输出文本仅为Hello my。如何让它打印我所有的输入文本行,而不仅仅是第一行?
【问题讨论】:
-
while (<$fh>){ print; }