in reply to Re: Fiddling with File::Find
in thread Fiddling with File::Find

If I paste your snippet into a sample program strict complains about $name not being defined. If I include the two statements:
use vars qw/*name/; *name = *File::Find::name;
it works, but I get a warning message: Name "File::Find::name" used only once: possible typo at search.pl line 12 What is the proper way to define $name when using strict and warnings so that no messages are generated?

"Whether you think that you can, or that you can't, you are usually right." -- Henry Ford

Replies are listed 'Best First'.
Re: Re: Re: Fiddling with File::Find
by chromatic (Archbishop) on Nov 19, 2001 at 01:01 UTC
    Use those lines *before* you use warnings. It's a rather spurious warning, but hard to smack down in the source code.
      I appreciate your taking the time to hunt this down. Particulary since it is a relatively stale post. Maybe I should whine more often. (:

      This does work as you suggested if I use:  use warnings; but it doesn't seem to help if I use  perl -w. I seem to recall reading a post sometime back describing the differences between the two, so I'll look for it again. Maybe I don't really need to use "-w".

      Thanks again for your diligence!

      --Jim

Re: Re: Re: Fiddling with File::Find
by merlyn (Sage) on Oct 06, 2001 at 19:53 UTC
    Sorry. I snipped your snippet in haste. Change $name to $File::Find::name. As for the warning, this is one of those times when the warning is a warning, but not really doing anything wrong. That's why I don't code "warning-free" occasionally.

    -- Randal L. Schwartz, Perl hacker