[oak perl] file::find vs. learning recursive subs

dbkliv dbkliv at gmail.com
Fri Feb 18 09:08:25 PST 2005


On Fri, 18 Feb 2005 07:33:53 +0000, Sandy Santra <santranyc at yahoo.com> wrote:
> Belden, that script was amazing--but way over my head.
> I didn't know about file::find, use constant, or the even
> the value of including a prompting feature for the file
> rename (duh!).  So you've opened my eyes in a half dozen
> ways (yes, there were other eye-openers in your script)--thanks.
> 

Glad to hear this.

> I think for now I'm going to follow Michael Paoli's advice
> and do it the hard way, which will help me learn scoping
> and many other things.  (Thanks, Michael!  At first I balked
> at doing the work, but now I see the value.)  Anyway, working
> with a looping sub is just about my speed right now.

Glad to hear this too. There's nothing wrong with trying to
do it yourself: just don't forget that you don't *have* to.

I suggest incorporating a prompting feature ("really do this?")
in your code. Not only will this give you a chance to make sure that
everything's working how you expect, it'll also give you the chance
to hit Control+C to exit the script if you notice it has entered an
infinite loop.

It's probably not a bad idea to make a sandbox for testing. On Windows,
you could do this by opening a DOS prompt and running:

    C:\> mkdir C:\sandbox
    C:\> cd C:\sandbox
    C:\sandbox> echo > file1%f1%f2.txt
    C:\sandbox> echo > file2%f1%f2.txt

Make a few sub directories under C:\sandbox, and put fake files in them
too.

>  Just the beginning, but fun!

Yes indeed :)

Belden


More information about the Oakland mailing list