Hi all,
In my script doing the following requirement,
I need to check one temporary file , that file contains the position of
the file handle
if the temporary file is not present then open "abc" file and read the
datas for some calculation after that update the last line position to
the temporary file
suppose the temporary is present then need to seek the already stored
file position from "abc" file , if the that position is not catched in
"abc" file then will continue the seeking process from "abc.0", if also
not catched then seeking from "abc.1" .... this is up to "abc.10"
once if the already stored file position is catched then store that
filename up to "abc" in to one array.
for example if the file position is catched in "abc.3" then need to push
the following information in to array,
abc.3 abc.2 abc.1 abc.0 abc
the started script is shown below,
#! /usr/bin/perl
use warnings;
use strict;
if ( ! -e "tmp.txt")
{
open FF, "abc" || die "can't open abc file\n";
while (<FF>)
{
chomp;
#some calculation
}
my $pp=tell(FF);
open FP, "> tmp.txt" || die "can't open the tmp file\n";
print FP $pp;
close FP;
close FF;
}
else
{
open FF,"tmp.txt" || die "can't open the file\n";
while(<FF>)
{
chomp;
my $pp=$_;
}
# need to check , but have some trouble of from which file to start and
forming the array
}
Could you help me to completing the else part??
Thanks,
Siva