in reply to Hi Monks could you pls help Perl dummy user
recursion doesn't work i don't know why?
Because your read_dir is not safe to use for recursion - $dir and all the other variables in the sub are global. You need to use lexical variables, for example my $dh instead of DH, to make them local to the blocks they are defined in. Using warnings and strict (use warnings; use strict;) will help you with this and many other potential problems.
without fancy module
Why? File::Find is in the core.
use File::Find; find( sub { return unless -r && -f; my $size = -s; print "$File::Find::name $size\n" if $size > 51200; }, $path );
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Hi Monks could you pls help Perl dummy user
by LanX (Saint) on Dec 17, 2014 at 01:51 UTC | |
by sibyurik (Novice) on Dec 17, 2014 at 01:58 UTC | |
|
Re^2: Hi Monks could you pls help Perl dummy user
by sibyurik (Novice) on Dec 17, 2014 at 01:40 UTC | |
by LanX (Saint) on Dec 17, 2014 at 01:46 UTC | |
by sibyurik (Novice) on Dec 17, 2014 at 01:50 UTC | |
by LanX (Saint) on Dec 17, 2014 at 02:06 UTC | |
|
Re^2: Hi Monks could you pls help Perl dummy user
by jellisii2 (Hermit) on Dec 17, 2014 at 14:41 UTC | |
|
Re^2: Hi Monks could you pls help Perl dummy user
by sibyurik (Novice) on Dec 17, 2014 at 02:11 UTC |