On Fri, 9 Apr 2004, Shachar Shemesh wrote:

> 1. I know, I write perl like a C programmer, I can't help it. Feel free
> to show me how it's done.
Probably you should use File::Find
Try this code as a starter:

use File::Find;
$dirname = shift @ARGV;
find(\&myfunc, $dirname);

sub myfunc {
    printf "%s  %s\n", $_, -d $_;
}

also look at
perldoc File::Find

> 2. For some strange reason, the moment I recurse once, the entire loop
> structure exits. I suspect it's because the DIR handle is global. Will
> any perl guru comment on how it's supposed to be done?
wrong question :-)
TMTOWTDI


> 3. What the @$([EMAIL PROTECTED] is the difference between "my" and "local"? Which
> one should I use here?

local is nearly obsolete, you should nearly always use my.
my    - gives you lexical scoping (within the same {} block);
local - gives you a scoping within the current {} AND all the
        functions called from within this {} block.

try reading
perldoc -f local
perldoc -f my


See also
  www.perl.org.il

Gabor

=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to