【发布时间】:2016-06-03 00:07:28
【问题描述】:
当我运行这个脚本时:
#!/usr/bin/perl
use warnings;
use strict;
use feature qw{ say };
my @header = split ' ', <>;
my $last = q();
my @keep;
for my $i (0 .. $#header) {
my ($prefix) = $header[$i] =~ /(.*)\./;
if ($prefix eq $last) {
push @keep, $i + 1;
}
$last = $prefix;
}
unshift @header, q();
say join "\t", @header[@keep];
while (<>) {
my @columns = split;
say join "\t", @columns[@keep];
}
然后我得到这个错误:
Use of uninitialized value in join or string at./first.perl line 21, <> line 3986.
你能指导我如何摆脱这个错误吗? 我应该改变一些可能的数据文件吗?因为当在一个小数据文件中运行这个脚本时,我没有得到错误。但是当我运行它是我的真实数据文件时,我得到了错误。
【问题讨论】: