$ ./stat3.pl $VAR1 = { './stat1.pl' => { 'w' => 1, 'r' => 1, 'x' => '', 's' => 393 }, './causes2.txt' => { 'w' => 1, 'r' => 1, 'x' => '', 's' => 299 }, ... }, './stat3.pl' => { 'w' => 1, 'r' => 1, 'x' => 1, 's' => 293 }, './template_stuff' => { 'w' => 1, 'r' => 1, 'x' => 1, 's' => 4096 }, }; $ cat stat3.pl #!/usr/bin/perl -w use strict; use v5.12; use Data::Dumper; my @files = glob('./*'); my %stat = map { lstat($_) or die "Can't lstat $_: $!"; $_ => { r => ( -r _ ), w => ( -w _ ), x => ( -x _ ), s => ( -s _ ), } } @files; my $hashref = \%stat; print Dumper($hashref); $ #### $ ./stat2.pl ... ./stat3.pl is executable ./stat3.pl has a size of 293 bytes, uses 8 "blocks" of 512 bytes, the filesystem uses a block size of 4096 bytes ./template_stuff is a directory ./template_stuff has a size of 4096 bytes, uses 8 "blocks" of 512 bytes, the filesystem uses a block size of 4096 bytes $VAR1 = { ... './stat1.pl' => bless( [ 2049, 404418, 33204, 1, 1000, 1000, 0, 393, 1429336542, 1429336472, 1429336472, 4096, 8 ], 'File::stat' ), ... './template_stuff' => bless( [ 2049, 533854, 16893, 5, 1000, 1000, 0, 4096, 1429385812, 1429348668, 1429348668, 4096, 8 ], 'File::stat' ), #### struct stat { dev_t st_dev; /* ID of device containing file */ ino_t st_ino; /* inode number */ mode_t st_mode; /* protection */ nlink_t st_nlink; /* number of hard links */ uid_t st_uid; /* user ID of owner */ gid_t st_gid; /* group ID of owner */ dev_t st_rdev; /* device ID (if special file) */ off_t st_size; /* total size, in bytes */ blksize_t st_blksize; /* blocksize for file system I/O */ blkcnt_t st_blocks; /* number of 512B blocks allocated */ time_t st_atime; /* time of last access */ time_t st_mtime; /* time of last modification */ time_t st_ctime; /* time of last status change */ }; #### #!/usr/bin/perl -w use strict; use warnings; use v5.12; use File::stat 1.02 qw( stat lstat ); use Data::Dumper; my @files = glob('./*'); say "files are @files"; my %stat = map { $_ => lstat($_) } @files; # print out all sizes, as an example for my $fn (@files) { say $fn, ' is ', ( -d $stat{$fn} ? 'a directory' : -x $stat{$fn} ? 'executable' : 'not executable' ); say $fn, ' has a size of ', $stat{$fn}->size(), ' bytes, uses ', $stat{$fn}->blocks(), ' "blocks" of 512 bytes, the filesystem uses a block size of ', $stat{$fn}->blksize(), ' bytes'; } my $hashref = \%stat; print Dumper($hashref);