Hey everyone, here it the first viewing of my code. It works for being a recursive directory searcher. The only part that doesn't work is the unlink portion. I'm still working on that. But, have a look and let me know what you think. Thanks for the support.
#!/usr/bin/perl -w use Cwd; print "Enter start directory: $workdir"; chomp($workdir = <STDIN>); sub scandir { my ($workdir) = shift; #c:\mydocu~1\Netscape my ($startdir) = &cwd; #c:\mydocu~1\perl chdir($workdir) or die "Unable to change to $workdir:$!\n"; opendir(DIR, ".") or die "Unable to open $workdir:$!\n"; my @files = readdir(DIR) or die "Unable to read $workdir:$!\n"; closedir(DIR); foreach my $file (@files) { next if ($file eq "."); next if ($file eq ".."); if (-d $file) { &scandir($file); next; } if ($file eq '/\.log$/i || /\.\d+\w+\-\d+\wm$/i') { unlink($file) || warn "Unable to delete $file: $!\n"; } else{ print "Found File: $file\n"; } chdir($startdir) or die "Unable to change to $startdir: $!\n"; } } &scandir(".");
Thanks Again!!!! curtisb = Upcoming Perl Programmer "Start Slow and Small!!!!"

In reply to First code test view by curtisb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.