in reply to comparing size
To find the size of a file you can use:
my $size = -s $file;
The -X file tests are documented here.
You could also use the core module File::stat which provides dev, ino, mode, nlink, uid, gid, rdev, size, atime, mtime, ctime, blksize, and block. I tend to find this easier than remembering what order stat returns things.
use File::stat; my $st = stat($file); my $size = $st->size;
gav^
In Section
Seekers of Perl Wisdom