dude01 has asked for the wisdom of the Perl Monks concerning the following question:

i need to run the unix command ud < filename and read the output into my perl script I tried
open (UDPIPE, "(ud < CoreCust.ud)|")
but it doesn't work

Replies are listed 'Best First'.
Re: how do i read input from Unix command
by Zaxo (Archbishop) on Aug 30, 2001 at 07:04 UTC

    Try backticks:

    my $output = `ud < CoreCust.ud`;
Re: how do i read input from Unix command
by Hofmator (Curate) on Aug 30, 2001 at 13:21 UTC

    To add to Zaxo's answer, you can read the output linewise into an array as well: my @cmd_lines = `ud < CoreCust.ud`; Maybe you have to redirect STDERR, if this is where the command sends its output to. How to do this depends on your shell, on bash you'd write e.g. ud < CoreCust.ud 2>&1 to redirect STDERR to STDOUT. This should work both with backticks and with your open-pipe solution.