Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • It'll quit too soon if someone created foo/bar/baz/and/another/thing/, yet there is any level between 1 and 5 that contains no .pl files in any directory at that level. It'll give a wrong answer if someone created a directory (or pipe or ...) that matches *.pl - you'll have someone to blame for your problem, though.

    This should work (modulo any bugs - I just typed it in off the top of my head...):

    @dirs = ( '.' );

    while (@dirs) {
        my $dir = shift @dirs;
        DIR = opendir $dir;
        foreach my $file (<DIR>) {
            my $fullfile = "$dir/$file";
            -f $fullfile && ($file =~ /\.pl$/) && print "$fullfile\n";
            -d _ && push @dirs, $fullfile;