in reply to Traversing through a directory structure

Have you considered using a recursive function?
#!/usr/bin/perl -- use strict; use warnings; my $LogFile = '/tmp/report.txt'; open ( OUTPUT, '>', $LogFile ) or die "Can't write to $LogFile : $!"; get_permissions ( $_ ) foreach @ARGV; close (OUTPUT) or die "Can't save $LogFile : $!"; sub get_permissions { my $directory = shift; opendir (DIR, $directory) or warn "Can't open directory $directory : $!" and return; my @files = grep { !m/^.{1,2}$/ } readdir DIR; closedir (DIR); foreach my $file (@files) { # do whatever you want for each file # see 'stat' for all but the acls print OUTPUT `ls -ld '$directory/$file'`, `lsac '$directory/$file'`; # and recurse on directories if (-d "$directory/$file") { get_permissions("$directory/$file"); } } }