From: Thomas Barth on
Hi,
any Idea how to get the output of this command into an array? The output
is still printed to the screen. The array @soxin keeps empty.

open(SOXIN, "sox $path -r 8000 -c 1 $src_dir/$basename.vox stat |");
my @soxin = <SOXIN>;
close(SOXIN);

Thomas B
From: Thomas Barth on
Thomas Barth schrieb:
> Hi,
> any Idea how to get the output of this command into an array? The output
> is still printed to the screen. The array @soxin keeps empty.
>
> open(SOXIN, "sox $path -r 8000 -c 1 $src_dir/$basename.vox stat |");
> my @soxin = <SOXIN>;
> close(SOXIN);
>

Hi,
its cleared, I got it with the command
open(SOXIN, "sox $path -r 8000 -c 1 $src_dir/$basename.vox stat 2>&1 |");

Thomas B



From: sharma__r on
On Nov 13, 7:31 pm, Thomas Barth <txba...(a)web.de> wrote:
> Thomas Barth schrieb:
>
> > Hi,
> > any Idea how to get the output of this command into an array? The output
> > is still printed to the screen. The array @soxin keeps empty.
>
> >     open(SOXIN, "sox $path -r 8000 -c 1 $src_dir/$basename.vox stat |");
> >     my @soxin = <SOXIN>;
> >     close(SOXIN);
>
> Hi,
> its cleared, I got it with the command
> open(SOXIN, "sox $path -r 8000 -c 1 $src_dir/$basename.vox stat 2>&1 |");
>
> Thomas B


Or this:

my @soxin = split /\n/, qx/ sox $path -r 8000 -c 1 $src_dir/
$basename.vox stat /;
From: J�rgen Exner on
Thomas Barth <txbarth(a)web.de> wrote:
>Hi,
>any Idea how to get the output of this command into an array? The output
>is still printed to the screen. The array @soxin keeps empty.
>
> open(SOXIN, "sox $path -r 8000 -c 1 $src_dir/$basename.vox stat |");
> my @soxin = <SOXIN>;
> close(SOXIN);

You could use simple backticks. But that shouldn't be much different
from the pipe. Maybe your sox command is writing to STDERR instead of
STDOUT?

jue
From: Uri Guttman on
>>>>> "sr" == sharma r <sharma__r(a)hotmail.com> writes:

sr> On Nov 13, 7:31�pm, Thomas Barth <txba...(a)web.de> wrote:
>> Thomas Barth schrieb:
>>
>> > Hi,
>> > any Idea how to get the output of this command into an array? The output
>> > is still printed to the screen. The array @soxin keeps empty.
>>
>> > � � open(SOXIN, "sox $path -r 8000 -c 1 $src_dir/$basename.vox stat |");
>> > � � my @soxin = <SOXIN>;
>> > � � close(SOXIN);
>>
>> Hi,
>> its cleared, I got it with the command
>> open(SOXIN, "sox $path -r 8000 -c 1 $src_dir/$basename.vox stat 2>&1 |");
>>
>> Thomas B


sr> Or this:

sr> my @soxin = split /\n/, qx/ sox $path -r 8000 -c 1 $src_dir/
sr> $basename.vox stat /;

no need for the split. backticks/qx will split on \n in a list context.

also that won't work as you are using / for the delimiter and / is on
the data. so use another delimiter and {} is usually the best choice
there.

uri

--
Uri Guttman ------ uri(a)stemsystems.com -------- http://www.sysarch.com --
----- Perl Code Review , Architecture, Development, Training, Support ------
--------- Gourmet Hot Cocoa Mix ---- http://bestfriendscocoa.com ---------