如何在目录中打印变量 $newFile 的输出?我怎样才能使用'cp'来做到这一点?修改后,我的代码如下所示:
#!/usr/bin/perl
use strict;
use warnings;
use Data::Dumper;
use File::Copy 'cp';
# binmode(STDOUT, ":utf8") ;
# warn Dumper \@repertoire;
my @rep= glob('/home/test/Bureau/Perl/Test/*'); # output to copy in this dir
foreach my $file (@rep)
{
open(IN, $file) or die "Can't read file '$file' [$!]\n";
while (<IN>)
{
my ($firstCol, $secondCol) = split(/","/, $_);
$firstCol =~ s/http:\/\//_/g;
$secondCol =~ s/\(.+\)/ /ig;
my $LCsecondCol = lc($secondCol);
chomp($secondCol);
chomp($LCsecondCol);
my $newFile = "$firstCol:($secondCol|$LCsecondCol);";
$newFile =~ s/=//g;
print "$newFile\n";
}
close(IN);
}