chomp() を使用して、ファイルからすべての改行文字を削除しようとしています。コードは次のとおりです。
use strict;
use warnings;
open (INPUT, 'input.txt') or die "Couldn't open file, $!";
my @emails = <INPUT>;
close INPUT;
chomp(@emails);
my $test;
foreach(@emails)
{
$test = $test.$_;
}
print $test;
input.txt ファイルのテスト コンテンツは単純です。
hello.com
hello2.com
hello3.com
hello4.com
私の予想される出力は次のようなものです:hello.comhello2.comhello3.comhello4.com
ただし、入力ファイルと同じコンテンツを取得しています。何か助けてください。
ありがとうございました