Skip to content

Instantly share code, notes, and snippets.

@jacoby
Created November 5, 2018 22:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jacoby/49883d6d9effe3200d50aefffbf106ca to your computer and use it in GitHub Desktop.
Save jacoby/49883d6d9effe3200d50aefffbf106ca to your computer and use it in GitHub Desktop.
$obj->{output}{plate}->@* =
map { delete $_->{pi} if $_->{pi} eq ''; $_ }
sort { $a->{i7} cmp $b->{i7} }
sort { $a->{i5} cmp $b->{i5} }
sort { $a->{pi} cmp $b->{pi} }
grep {
state $hash = {};
my $obj;
$obj->{pi} = $_->{pi} if $_->{pi};
$obj->{i7} = $_->{i7};
$obj->{i5} = $_->{i5};
my $key = $json->encode($obj);
$hash->{$key}++;
$hash->{$key}>1?0:1;
}
sort { length $json->encode($b) <=> length $json->encode($a) }
map { $_->{pi} = $_->{pi} || ''; $_ }
$obj->{output}{plate}->@*;
say $json->encode( $obj->{output}{plate} );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment