If I run the application A from the command line, it will write some
output to screen and continue running on the foreground.
Now, in my perl tool program, I will call the application A and
collect some output of that application A. my perl program will be
used on Unix/Linux/Win32 system.

My program like this, I don't close the filehandle FH, because I want
the appA to run at the background for ever.

open FH,"appA |";
my @result =<FH>;

foreach (@result) {
print $_ if m/patten/;
}

But I don't get the expect as what I want, my perl program never
exit, because the appA is running.

how to fix my perl program?