my $out = "/home/users/user/tmp/$progname_$today.dat"; #### my $out = "/home/users/user/tmp/${progname}_$today.dat"; #### call_dir($p=1) ... sub call_dir { if ($p == 1) ...

would be better as:

call_dir(1) ... sub call_dir { my ($p) = @_; if ($p == 1) ##
## my $main = "/home/users/user"; my @rootDirs = ("$main/tmp/", "$main/exe"); ... find ({wanted => \&data_for_path, follow=>1, follow_skip=>2}, @rootDirs);