linux - Perl + Linux 在多个文本位置重新排列列

标签 linux perl

#!/usr/bin/perl

use strict;
use warnings;

my $file;
my @files;
my $parse;
my @files = <*>;
foreach $file(@files)
 chomp ($file);
{
 $parse = system qq(paste <(cut -f1,2,13 $file) <(cut -f12 $file));
}
<小时/>
"my" variable @files masks earlier declaration in same scope at Rast_seq.pl line 11.
sh: 1: Syntax error: "(" unexpected
sh: 1: Syntax error: "(" unexpected
sh: 1: Syntax error: "(" unexpected
sh: 1: Syntax error: "(" unexpected
sh: 1: Syntax error: "(" unexpected
sh: 1: Syntax error: "(" unexpected

请帮我解决这个错误。

最佳答案

将左大括号 { 移到 chomp;
之前 并删除第一个 my @files;
并更改 qq

的分隔符
my $file;
my $parse;
my @files = <*>;

foreach $file(@files) {
    chomp ($file);
    $parse = system qq#paste <(cut -f1,2,13 $file) <(cut -f12 $file)#;
}

关于linux - Perl + Linux 在多个文本位置重新排列列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15474091/

相关文章:

perl - 在不创建本地副本的情况下取消引用哈希

Perl: "system"什么时候真正返回?

python - 在 Linux 中调试 Python 文件

linux - 在不使用 yum 的情况下在 64 位 RHEL 上安装 32 位库 (glibc)

windows - 如何在 Windows 上运行多个 Perl 脚本而不打开单独的命令窗口?

linux - 在 Perl 中连接数千个文件的最有效方法

linux - 无法使用适用于 Windows 10 的 Cygwin 在 ffmpegthumbnailer 安装文件上使用 Makefile

Heroku 上的 PHP 多字节字符串

windows - 混合 Windows 和 *nix 环境 - 'local' 后缀问题

perl - cpanm 不安装模块