in reply to recursing problem

I'm not sure what you want, but I would suggest looking at File::Find. There are variants depending upon what you want.

The code below descends from the $start_dir and prints the full path names of all files.

Recursive directory descent is a well known problem and I would use one of the well known solutions unless this is some kind of a homework problem.

#!/usr/bin/perl -w use strict; use File::Find; #a core module my $start_dir = "C:/Exam"; find (\&wanted, ($start_dir)); sub wanted { print "$File::Find::name\n" if -f; }