http://qs1969.pair.com?node_id=1224108


in reply to Parallel::ForkManager for any array

Tip #1 from the Basic debugging checklist: use warnings

You will see a warning message

Unquoted string "i" may clash with future reserved word at ...
You should change:
system ("rm", "-fr", $files[i]);
to:
system ("rm", "-fr", $files[$i]);
If you use Tip #6 from the Basic debugging checklist (B::Deparse), you will see how Perl interprets your code:
system 'rm', '-fr', $files[0];

Replies are listed 'Best First'.
Re^2: Parallel::ForkManager for any array
by MissPerl (Sexton) on Oct 16, 2018 at 13:51 UTC
    Oh yes, what's wrong with me forgetting those strict and warnings. thank you !

    Oh it is the $i . great thanks much !! =D

    I could not test it now. but on a side note, in this case, let's say the directories have 8 files and 2 directories, does it mean it assign 8 children for 8 files and 2 children for 2 subdirectories?

    What if i have 11 files/subdirectories in the directory with only 10 forks, does the quickest child/process get the 11th ??