open (FILE,"<","cpbs.txt") || die "cannot open the file:$!\n"; my @temp=<FILE>; foreach (@temp) { print "Found $_\n"; } close FILE; 读入大型文件: open (FILE,"cpbs.txt") || die "cannot open the file:$!\n"; while (<FILE>){ print "Found $_\n"; } close FILE; 一次读入一行,可以减少内存占用。