#!/usr/bin/perl use warnings; use strict; use File::stat; my $filename = "data.txt"; if (my $stat = stat $filename) { print "'$filename' is ", $stat->size, " bytes and occupies ", $stat->blksize * $stat->blocks, " bytes of disc space \n"; } else { print "Cannot stat $filename: $| \n"; }