David wrote:
> 
> Hello everyone,

Hello,

>         I need to display the files in a directory, files in directories in
> that directory, etc....  My question is, how do I move through the
> directory?  For various reasons I can not use modules from CPAN.  I'm
> familiar with iteration and recursion, I only need to know what built in
> functions to use.  If possible, a code example would be appreciated.


$ perl -e'
sub dir {
    my $dir = shift;
    opendir my $dh, $dir or die "Error: $!";
    my @files = grep !/^\.\.?$/, readdir $dh;
    closedir $dh;
    for my $file ( @files ) {
        print "$dir/$file\n";
        dir( "$dir/$file" ) if -d "$dir/$file";
        }
    }
dir( "." )'



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to