in reply to How to implement something similar to Unix's find syntax?

I am just trying to create a funny code. It accepts two arguments directory to search and filename
It will work on Unix. you can make it work on Windows by reversing the slash.
Just try perl <script name> <dir name> <file name>
my ($mydir, $word) = (@ARGV); opendir(DIR, "$mydir") || warn "can't opendir : $!"; @dots = grep { /\w/ } readdir(DIR); closedir DIR; foreach $dir_tree(@dots) { #print "$dir_tree\n"; opendir(DIR, "$dir_tree"); @dots1 = grep { /\w/ } readdir(DIR); foreach $dir_tree1(@dots1) { push @dots, "$dir_tree/$dir_tree1"; my $name = "$dir_tree/$dir_tree1"; print "$dir_tree/$dir_tree1\n" if ($name =~ m/\Q$word\ +E/is); } closedir DIR; }

Replies are listed 'Best First'.
Re^2: How to implement something similar to Unix's find syntax?
by moritz (Cardinal) on May 25, 2007 at 12:59 UTC
    I think the original intention was to implement a parser for options similar to find.

    If I understand the original posting correctly, it has nothing to do with actually finding files, but to apply that logic to a completely different problem.