_END_を__END__に直して挑戦
ele_dirさんとperlcodesampleさんのアドヴァイスを参考に、修正して挑戦。
#!/usr/bin/perl my @files=@ARGV; foreach my $file(@files){ open(my $fh, "<", $file) or die "Cannot open $file"; while(my $line=<$fh>){ print $line; } close($fh); } __END__
これをsample.plにして保存。コードも自動色付きにできました。 ソースコードを色付けして記述する(シンタックス・ハイライト)
komadas-Computer:~ komada$ chmod +x sample.pl
komadas-Computer:~ komada$ perl sample.pl food.txt food2.txt food3.txt
I like an apple.
He ate a banana.
I cooked some corn.
She has some donuts.Pooh likes honey.
He finds honeycomb and eats honey.
He also likes honey pies.
But, he is often followed by honey bees. Pooh is eating honey pies.
He is eating tree honey pies.
He is eating two apple pies.
He has a great appetite.komadas-Computer:~ komada$
うまく動かせました。貴重なアドヴァイスをありがとうございます。