in reply to Problem printing contents of file
To check the size of a file, you can do something like the following:open(FILE, '<', '../frame.txt') or die $!; while(<FILE>) { print $_, "\n"; } close(FILE);
7 hours sleep in 2 days is not healthymy $file = '../frame.txt'; if(-s ($file) >0) { open(FILE, '<', $file) or die $!; while(<FILE>) { print $_, "\n"; } close(FILE); }else{ print "$file contains no data\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Problem printing contents of file
by ikegami (Patriarch) on Jun 17, 2008 at 14:58 UTC | |
|
Re^2: Problem printing contents of file
by ketaki (Acolyte) on Jun 18, 2008 at 06:16 UTC | |
by Corion (Patriarch) on Jun 18, 2008 at 06:34 UTC | |
by ketaki (Acolyte) on Jun 18, 2008 at 08:23 UTC | |
by Anonymous Monk on Jun 18, 2008 at 10:18 UTC |