- open F, "find -name '*.pl' |" or die "cannot open";
-
while(<F>){
-
print;
-
}
-
open DATE, "who |" or die "cannot pipe from date: $!";
-
open MAIL, "|mail -s 'test' yanx.y.liu\@intel.com" or die "cannot pipe to mail $!";
-
my @now = <DATE>;
-
print MAIL "The time is now @now";
-
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) |