您的位置:首页 > 其它

虚拟文件系统相关结构描述

2012-05-07 17:21 218 查看
http://www.perlmonks.org/index.pl?node_id=287647

open FILEHANDLE, 'somefile.txt' or die $!;
my $string = do { local $/; <FILEHANDLE> };

The above idiom is a consise way to "slurp" the entire contents of a file into a scalar without using a loop, such as:

open FILEHANDLE, 'somefile.txt' or die $!;
my $string = '';
while (<FILEHANDLE>) {
$string .= $_;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: