in reply to Merge hashes in specific format

encode returns a scalar, not an array

sub encode { my ($path,$href) = @_; # my @json_arr = JSON::PP->new->encode($href); # return convert_file_to_arr($path,@json_arr); my $json_text = JSON::PP->new->encode($href); return convert_file_to_arr($path,$json_text); }

Also, what does convert_file_to_arr() actually do ?

If as Discipulus advised you want to change your sub names then see here

poj