system("grep 'packet loss' ... > /home/.../$TARGET_HOST.PL.log"); #### open(PL, "grep ... | ... |") or die "unable to open pipe from grep command: $!"; while () { ... } close(PL);