Chinaunix首页 | 论坛 | 博客
  • 博客访问: 858875
  • 博文数量: 253
  • 博客积分: 6891
  • 博客等级: 准将
  • 技术积分: 2502
  • 用 户 组: 普通用户
  • 注册时间: 2010-11-03 11:01
文章分类

全部博文(253)

文章存档

2016年(4)

2013年(3)

2012年(32)

2011年(184)

2010年(30)

分类: Python/Ruby

2011-10-18 13:43:52

  1. open F, "find -name '*.pl' |" or die "cannot open";
  2. while(<F>){
  3.     print;
  4. }
  5. open DATE, "who |" or die "cannot pipe from date: $!";
  6. open MAIL, "|mail -s 'test' yanx.y.liu\@intel.com" or die "cannot pipe to mail $!";
  7. my @now = <DATE>;
  8. print MAIL "The time is now @now";
  9. close MAIL or die"mail: non-zero exit of $?";
"command |" the filehandle will read the containt from the result of the command.
"| command" the filehandle now pass the containt to the command.
the close Filehandle will end the input operation.
Closing a filehandle attached to a process waits for the process to complete so that Perl
can get the process’s exit status.


阅读(307) | 评论(0) | 转发(0) |
0

上一篇:`` backquotes

下一篇:signals

给主人留下些什么吧!~~