in reply to fork and reap
That should be efficent enough.smallest{ my ($dir,$arr_ref)=@_; my %sc; #Cache of file sizes; return +(sort {$sc{$a}||=-s $a; $sc{$b}||=-s $b; $sc{$a} <=> $sc{$b} } map { "$dir/$_" } @$arr_ref)[0]; }
As for the rest, I don't understand what you try to do. You have one main loop. The first thing you do, is to shift a file off @dbFilePaths. That means it will only go through that loop once for all those filepaths. Inside the loop is one big if/elsif block. So, for each of those FilePath's, one of those blocks will be executed, and finally you fork of, presumably to execute the command you set in the if/elsif block
Furthemore, since you never set @copiedFiles or @verifiedFiles, 2 of those blocks will never get executed. I think you should try to post a version that you feel is somewhat correct, or failing that, put in some comments on what you think is going on in the code
GoldClaw
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: fork and reap
by Anonymous Monk on Mar 15, 2001 at 05:03 UTC |