##################################
按行读取文件
##################################
open(FILE,"filename") || die "can not open the file: $!";
while (defined ($eachline
=))
{
chomp $eachline;
print $eachline."\n";
}
close FILE;
##################################
把文件全部读到变量里面
##################################
$AllData="";
open(FILE,"filename");
read(FILE,$AllData,-s FILE); # Suck in the whole file
close(FILE);
##################################
把文件全部读到内存里面-01
##################################
open(FILE,"filename") || die"can not open the file: $!";
@filelist=;
foreach $eachline (@filelist)
{
chomp $eachline;
}
close FILE;
##################################
把文件全部读到内存里面-02
##################################
open(FILE,"filename") || die"can not open the file: $!";
@filedata=;
close FILE;