The seek Function randomly accesses a file: seek(FILEHANDLE, BYTEOFFSET, FILEPOSITION); : file seek « File « Perl






The seek Function randomly accesses a file: seek(FILEHANDLE, BYTEOFFSET, FILEPOSITION);

    

#Positions are
#0 = Beginning of the file
#1 = Current position in the file
#2 = End of the file

open(FH,"db") or die "Can't open: $!\n";
while($line=<FH>){
    if ($line =~ /LLLL/) { 
       print "--$line--\n";
    }
}
seek(FH,0,0);   
while(<FH>) {
   print if /Sss/;
}

   
    
    
    
  








Related examples in the same category

1.Seek a file
2.Seek a minus value
3.Seek and tell.
4.Seek current position
5.Seek log file
6.Using seek function from IO:File
7.The seek Function randomly accesses a file.
8.File seek operations
9.Move file pointer by using the seek function