# opne the pipe, check if fork passed open PIPE, "|$prog" or die $!; # do something with the command like print PIPE @files; # check if the command completed successfully close PIPE or die "Command failed : $! || $?";