sub decode { my ($path,$href) = @_; unless (-e $path) { return 0; } my ($json_data,@jarr); convert_file_to_arr($path,\@jarr); # inserts lines as elements of array $json_data = (join "",@jarr); %{$href} = %{JSON::PP->new->decode($json_data)}; return 1; }