次の行を含む「input.file」という名前のファイルがあります。
フーは$COLORです
$COLOR には「赤」が割り当てられており、次の行で「output.file」という名前の 2 番目のファイルを作成しようとしています。
フーは赤い
これが私の失敗した試みです:
#!/usr/bin/perl
use strict;
use warnings;
my $COLOR = "red";
open(FILE_IN, "< input.file");
open(FILE_OUT, "> output.file");
while (<FILE_IN>){
# Prints 'Foo is $COLOR' to 'output.file'
print FILE_OUT;
}
close FILE_IN;
close FILE_OUT;
# Prints 'Foo is red' to STDOUT
print "Foo is $COLOR\n";
'output.file' に出力するとき、'$COLOR' ではなく 'red' を出力するにはどうすればよいでしょうか?
ありがとう