Help for this page

Select Code to Download


  1. or download this
    open FILE, "|du -sk|" or die "$!";
    print FILE `ls`;
    print while(<FILE>);
    
  2. or download this
    The open2() function runs the given $cmd and connects $rdrfh
    for reading and $wtrfh for writing.  It's what you think
    ...
       $pid = open(HANDLE, "|cmd args|");
    
    The write filehandle will have autoflush turned on.
    
  3. or download this
    use IPC::Open2;
    
    ...
               # or without using the shell
             $pid = open2($rdrfh, $wtrfh, 'some', 'cmd', 'and', 'args');