sub resize_images { use 5.010; use Path::Class; use Image::Magick; my ($rvars) = shift; my %vars = %$rvars; opendir my $hh, $vars{to_images} or warn "warn $!\n"; while (defined ($_ = readdir($hh))){ my $image = Image::Magick->new; $image->ReadImage($_); $x = $image->Get('filesize'); say "$_ has filesize of $x"; } } #### Screenshot from 2014-08-21 13:10:18.png has filesize of Screenshot from 2014-09-25 17:14:08.png has filesize of Screenshot from 2014-08-21 13:22:42.png has filesize of zbears.jpg has filesize of . has filesize of .. has filesize of yjj.jpg has filesize of