# hard code a test link file to check $source_file = "/temp/test/source/dir1/hello1_link.txt"; # define filetype array with potential first bits of mode @ftypes = qw(. p c ? d ? b ? - ? l ? s ? ? ?); $ftypes0 = ''; # Get File Statistics Using Scalar context ($dev,$inode,$mode,$nlink,$uid,$gid,$rdev,$size, $atime,$mtime,$ctime,$blksize,$blocks) = stat($source_file); $perms = $mode & 07777; $octperms = sprintf("%lo", $perms); $filetype = $ftypes[($mode & 0170000)>>12]; $filelink = $ftypes[($mode & 0120000)>>12];