I'm trying to reopen a certain file but only if it's updated:
The problem is when i try to open a file (after it was changed and saved by me)for reading second time, i get nothing, like the file is empty but it's not.
The filehandle is empty.Why?
DOn't have a clue.
The code is below.
can some one help?
Thanks
Expand|Select|Wrap|Line Numbers
- $last_acces=time;
- while($end_ctsc)
- {
- $full_path_file=lastmodifiedfile("path");
- open (DATA_log ,$full_path_file);
- $file_stat = stat(DATA_log);
- $new_acces=$file_stat->mtime;
- close DATA_log;
- $Sub_is=$new_acces-$last_acces;
- if ($Sub_is)
- {
- $last_acces=$new_acces;
- $i=0;
- $full_path_file=lastmodifiedfile("path");
- open (DATA_log ,$full_path_file)||print("could not open the log");
- @file_log=<DATA_log>;
- close DATA_log;
- $sizefile_log = @file_log;
- print "the i is: $i, the sizefile_log is $sizefile_log\n";
- while ($i!=$sizefile_log)
- {
- #file handling
- }
- }