1, single line (large file processing):
 
 
 
  
  Copy Code code as follows: 
 
 
  
 
  
  
My $oneline = < $FL > or 
  
while ($line ={ } 
  
 
 
 
  
 
2, read all (small file processing):
 
 
 
  
  Copy Code code as follows: 
 
 
  
 
  
  
Open (My $in, "path") or Die "Open error: $!"; 
  
My @lines = < $in >; 
  
 
 
 
  
 
3, read 3 lines (large files and special processing needs):
 
 
 
  
  Copy Code code as follows: 
 
 
  
 
  
  
Open (My $in, "path") or Die "Open error: $!"; 
  
My @lines; 
  
Push (@lines, scalar < $in >) for (1..3); 
  
 
 
 
  
 
4. Read three lines per condition and two lines according to condition. or modify according to other specific requirements to achieve the corresponding purpose.
 
 
 
  
  Copy Code code as follows: 
 
 
  
 
 
while (<TEST>) { 
 
if (Index ($_, "=") >-1) { 
 
My $position =tell (TEST); 
 
My $keyword _line=$_; 
 
My $line _1=<test>; 
 
My $line _2=<test>; 
 
# @a=split//, $keyword _line; Compare their elements to be equal, never succeeded 
 
# @b=split//, $line _1; Use if ($a [0]eq $a [0]) to determine 
 
# @c=split//, $line _2; 
 
if ($line _2) && (Index ($line _2, "=") >-1)) {# or if ($line _2=~/=/) 
 
Print outfile "$_$line_1"; 
 
} 
 
if (!) ( $line _2)) {print outfile "$_$line_1"; last;} 
 
Seek (TEST, $position, 0); 
 
} 
 
}