my $user_inputs = analyse_user_inputs($Settings); print Dumper($user_inputs); #### $Settings = { batchplot_output_filename => "gps3", plot_all_variables => 'off', # DEFAULT PLOTS & VALUES default_values => [ { profiles => [qw(prof1 prof2)], linewidth => ["2"], single_dotnotes => 'On', legend => ["On"], }, ], #BEGIN CUSTOM PLOTS custom_plots => [ [ { yvars => 'LATDIIP', xvars => 'ELONGI', }, ], ] } #### sub analyse_user_inputs { my $hashORarray_ref = shift @_; my @the_inputs; if (ref $hashORarray_ref eq 'HASH') { foreach ( keys %{$hashORarray_ref} ){ # print "$_ \n"; push @the_inputs , $_ ; analyse_user_inputs($hashORarray_ref->{$_}); } } if (ref $hashORarray_ref eq 'ARRAY') { for (my $i = 0; $i < scalar(@{$hashORarray_ref}); $i++) { analyse_user_inputs($hashORarray_ref->[$i]); } } return(\@the_inputs); }