in reply to get list of files matching part of file name
What a strange way to use glob(). You're better off with proper use of readdir():
# open current directory for reading opendir my $dh, '.' or die; # iterate through the entries while (my $dir = readdir($dh)) { # your code here } closedir $dh;
If you want to use glob() properly, you need to do glob("*/*sample*") to get every file in the current directory's immediate subdirectories with 'sample' in its name.
There seems to be at least one real bug in your code: You aren't in /home/test when you do the glob.
In Section
Seekers of Perl Wisdom