There's no need to hold everything in memory, here,
since apparently "foreach" will read everything at
once in array context
(for some reason, I thought Perl5 was smart enough
to avoid creating a temporary array, here...)
my $fh = popen_rd(\@cmd) or die "popen_rd failed for $file: $!\n";
my %rv;
local $/ = "\n";
my $fh = popen_rd(\@cmd) or die "popen_rd failed for $file: $!\n";
my %rv;
local $/ = "\n";
- foreach my $line (<$fh>) {
+ while (defined(my $line = <$fh>)) {
chomp $line;
my ($k, $v) = split(/=/, $line, 2);
my $cur = $rv{$k};
chomp $line;
my ($k, $v) = split(/=/, $line, 2);
my $cur = $rv{$k};