use strict; use JSON; use Data::Dumper; my $json = ""; while() { $json .= $_; } my $d = from_json($json); my @v; foreach my $k (keys %$d) { $v[$d->{$k}] = $k; } print "$_\n" foreach(@v);