my $pid = open my $fhOut, "| the command ", or die ...; ## or my $pid = open my $fhIn, "the command |", or die ...; ## or using the 3-arg form on *nix systems my $pid = open my $fhOut, '|-', "the command ", or die ...; ## or my $pid = open my $fhIn, '-|', "the command", or die ...;