You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Was that capture or capture_stdout? I suspect the latter.
The "0" is probably the return value of system. The capture commands return the output and the return value of the block so you can say my $foo = capture { ... }.
So you don't really want to directly say the results of capture.
Was that capture or capture_stdout? I suspect the latter.
Yes. I was switching the code back and forth between the 2.
The "0" is probably the return value of system. The capture commands return the output and the return value of the block so you can say my $foo = capture { ... }.
So you don't really want to directly say the results of capture.
This is for Perl v5.14.2:
!/usr/bin/env perl
use feature 'say';
use strict;
use warnings;
use Capture::Tiny 'capture';
--------------------------
say capture{system('echo', 'Hello World')};
This outputs 2 lines. The 0 is unexpected:
Hello World
0
When using something like:
my($stdout) = capture{system('echo', 'Hello World')};
say $stdout;
Then the output contains just the 1 expected line.
Any ideas?
The text was updated successfully, but these errors were encountered: