Help for this page

Select Code to Download


  1. or download this
    use IPC::Open2;
    
    ...
    use FileHandle;
    my($rdr, $wtr) = (FileHandle->new, FileHandle->new);
    $pid = open2($rdr, $wtr, $cmd_with_args);
    
  2. or download this
    use IPC::Open2;
    use Symbol;
    ...
         $line = <$RDR>;         # read the output of bc(1)
         print STDOUT "$line";   # send the output to the user
    }
    
  3. or download this
    $pid = open2($RDR, $WTR, 'sort');
    
    ...
    while (<$RDR>) {     # now read the output of sort(1)
         print STDOUT "$_";
    }