i.e. being able to do
$result = `my command`;
using :raw
, :utf8
, etc.
Any special variables I don't know about, alternative methods or modules that can be used?
Well I don't know if there are any special variables, but why not use open() for that task? You can specify the encoding on pipes like you would on files:
open(my $cmdin, "-|:raw", "your command");
my $result = join('', <$cmdin>);
close($cmdin);
Use popen:
open (my $fd, "-|", $prog, @args)
or die "Couldn't start $prog: $!";
do_whatever($fd);
while (<$fd>) { ... };
Or if that's not enough you should look at IPC::Open2 and its cousin Open3.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With