open(PL, "grep ... | ... |") or die "unable to open pipe from grep command: $!"; while () { ... } close(PL);