I have been trying to use the seek function in a Perl script whose input file is in .gz format. I have opened the file using the following set of commands
if ($ARGV[0] =~ /.gz$/) {
open (FH1, "gunzip -c $ARGV[0] |") || die ("cant open file");
}
else {open (FH1, "<$ARGV[0]") || die ("cannot open file");
}
When seek function is used for a normal text file it is working fine, If is give a .gz file as input seek function is not working properly.
Is there any alternative for the seek function in this situation other than closing and opening the file wherever seek is used