in reply to Re: IPC::Cmd pipe array
in thread IPC::Cmd pipe array
That sorta works (ie, it doesn't error), but not really:
#!/usr/bin/env perl use strict; use warnings; use Data::Dumper; use IPC::Cmd qw/run/; my @in = ("Test foo", "Test bar"); print "In: " . Dumper(@in); @in = ("Test foo", "Test bar"); my @out = run(command => [echo => -n => @in] , '|', [ sed => -r => "s/ +(foo|bar)/pass/" ], '>', \my $out); print "Out: " . Dumper(@out); print "Redir: " . Dumper($out);
Out:
% ./t2.pl In: $VAR1 = 'Test foo'; $VAR2 = 'Test bar'; Out: $VAR1 = 1; $VAR2 = undef; $VAR3 = [ 'Test foo Test bar' ]; $VAR4 = [ 'Test foo Test bar' ]; $VAR5 = []; Redir: $VAR1 = undef;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: IPC::Cmd pipe array
by runrig (Abbot) on Oct 29, 2013 at 16:54 UTC | |
by ag4ve (Monk) on Oct 29, 2013 at 17:13 UTC | |
by ag4ve (Monk) on Oct 31, 2013 at 15:53 UTC |