use warnings; use strict; use JSON; my $file = 'codes.json'; my $data; { local $/; open my $fh, '<', $file or die $!; my $json = <$fh>; $data = decode_json $json; } print "$_: $data->{$_}\n" for sort keys %$data;