use strict; use File::Path 'mkpath'; use Data::Dumper; mkpath( 'a:/tmp', {error => \my $err}); @$err and print Dumper($err); __PRODUCES__ $VAR1 = [ { 'a:/' => 'Permission denied; The device is not ready' }, { 'a:/tmp' => 'Permission denied; The device is not ready' } ];