http://www.perlmonks.org?node_id=415137


in reply to Re^3: question about running a system and a perl function background
in thread question about running a system and a perl function background

Hi,

Thanks for the reply. I am using perl version 5.8.4 which you had suggested earlier.

I have been playing with the code...but could not understand:

last if keys %$lookfor == grep defined, values %$lookfor; $line =~ $_ and $lookfor->{ $_ } = $line for keys %{ $lookfor +};

I understand it means that for keys %{ $lookFor }, if $line =~ $_, then $lookFor->{$_} = $line...but was not sure what if keys %$lookfor == grep defined, values %$lookfor meant.

Also, had a little trouble understanding what the following means... (what does < do ?) :

sleep 1 while grep( $_, @dones ) < @cmds;

I understood that when the keywords are found, kill 1, $pid immediatly kills the pid for that particular thread, but does it also stop the other 3 threads that are still going on?

Thank you.