use File::stat; my $testfile = "/to/my/directory/test.file"; my $st = stat($testfile) or die "No $testfile: $!";