首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >运行<Programming Perl>中的示例时报告错误

运行<Programming Perl>中的示例时报告错误
EN

Stack Overflow用户
提问于 2011-09-20 12:50:30
回答 1查看 114关注 0票数 1
代码语言:javascript
复制
pipe(FROM_PARENT, TO_CHILD) or die "pipe: $!";
pipe(FROM_CHILD, TO_PARENT) or die "pipe: $!";
select((select(TO_CHILD), $| = 1))[0]); # autoflush
select((select(TO_PARENT), $| = 1))[0]); # autoflush
if ($pid = fork) {
    close FROM_PARENT; close TO_PARENT;
    print TO_CHILD "Parent Pid $$ is sending this\n";
    chomp($line = <FROM_CHILD>);
    print "Parent Pid $$ just read this: `$line'\n";
    close FROM_CHILD; close TO_CHILD;
    waitpid($pid,0);
} else {
    die "cannot fork: $!" unless defined $pid;
    close FROM_CHILD; close TO_CHILD;
    chomp($line = <FROM_PARENT>);
    print "Child Pid $$ just read this: `$line'\n";
    print TO_PARENT "Child Pid $$ is sending this\n";
    close FROM_PARENT; close TO_PARENT;
    exit;
}

它会报告Not enough arguments for select system call

什么意思?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2011-09-20 13:20:08

看起来像是打字错误。实际代码应该如下所示:

代码语言:javascript
复制
select((select(TO_CHILD), ($| = 1))[0]); # autoflush
select((select(TO_PARENT), ($| = 1))[0]); # autoflush
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/7480286

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档