# exec 3< /etc/passwd # grep root /proc/self/fd/3 root:x:0:0:root:/root:/bin/bash #### open(my $in, '/etc/passwd'); if (!fork()) { exec("grep", "root", "/proc/self/fd/" . fileno($in)); } close($in);