Same loop to generation to generate the arrays. Still seeing all values in the array before this: my @final_output; foreach my $line ( @output ) { next if ( grep m/^$line$/ @final_output ); push @final_output, $line; } <\code>
This time I don't see 0 results, the code just hangs. At first I thought, wow, is it really that inefficient? So I decide I can do better.

From a little reading about uniq I find out it essentially just slams the array values into a hash and then pulls the keys. I don't care about ordering, so why not just roll that myself?

my %output_hash; my $pk = "SomeString"; foreach my $pool ( @pools ) { my @machines = qx/Some command that gets me a list of machines/; #Some code here to check for cmd errors, etc. Convert output to an array of hashes (decode_json is involved); my $machine_aref = decode_json $machines[0]; foreach my $row ( @{$machines_aref} ) { $output_hash{$row->{$pk}} = 1; } } my @output_array = keys %output_hash; return \@output_array;