#!/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);