如何产生EOF给uniq

flow.pl 的代码:

...
$| = 1;
open(STDOUT, "| uniq") || die "Can't open pipe for uniq!";
if ($ARGV[0]) { #if a file is specified on the command line, use it instead of STDIN
  open(STDIN, "<$ARGV[0]") || die "Can't open file $ARGV[0]\n";
}
...



flow.pl从另外一个程序a获得持续性输入, 程序a必须用Ctrl+c终止。
命令行: a |?flow.pl | tee xxx
由于uniq需要读到EOF才能输出,我想在flow.pl收到INT信号时产生一个EOF给uniq, 应该怎么办呢?

当前flow.pl的INT处理函数为:

# Ctrl-C handler
sub siginthandler {
  print $newline;
  exit;
}