use strict;
use warnings;
search_dir (shift);
sub search_dir {
my $path = shift;
my @dir_entries = glob("$path/*");
foreach my $entry (@dir_entries) {
print $entry, "\n" if -f $entry;
search_dir($entry) if -d $entry;
}
}
####
use strict;
use warnings;
my @stack = @ARGV;
while (my $path = shift @stack) {
my @dir_entries = glob("$path/*");
foreach my $entry (@dir_entries) {
print $entry, "\n" if -f $entry;
push @stack, $entry if -d $entry;
}
}
####
use strict;
use warnings;
my @stack = @ARGV;
while (my $entry = shift @stack) {
print $entry, "\n" and next if -f $entry;
push @stack, glob("$entry/*");
}
####
use strict;
use warnings;
my @stack = @ARGV;
while (my $entry = shift @stack) {
print $entry, "\n" and next if -f $entry;
unshift @stack, glob("$entry/*");
}