in reply to Re: Question using system.
in thread Question using system.

Or you may use open with pipe, as described in perlipc. That allows you to work with the commands output as with any other (readonly) filehandle.

open(my $cmd, 'getfilesdata file.txt |')

Replies are listed 'Best First'.
Re^3: Question using system.
by ikegami (Patriarch) on Jul 10, 2008 at 18:28 UTC
    Better yet:
    open(my $cmd, '-|', 'getfilesdata', 'file.txt')

      Perhaps I don't understand IPC as well as I thought I did. ikegami, would you mind explaining why this is supposed to be better?

      
      -- 
      Human history becomes more and more a race between education and catastrophe. -- HG Wells
      

        It wasn't required for that particular command, but it avoids the need for shell quoting.

        # XXX Buggy and susceptible to injection attacks. open(my $cmd, "getfilesdata $file |") # Fixed open(my $cmd, '-|', 'getfilesdata', $file)