聘我网

新概念招聘3.0

perl如何实现PHP的file_get_contents?

vote up0vote downstar

初学,

有没有简单点的方法调用?

 

1 个答复

vote up0vote downcheck

内置的没有,

但简单封装下就行

sub file_get_contents {
    my ($file) = @_;
    open FD, '<', $file;
    local $/;
    my $contents = <FD>;
    close FD;
    return $contents;
}
链接

您的回答





不是您要找的问题? 浏览其他含有标签 的问题或者 自己问个.