DataStruct::Flat - Convert a data structure into a one level list of keys and values
use DataStruct::Flat; my $flattener = DataStruct::Flat->new; my $flat = $flattener->flatten({ a => [ 7, 8, 9, 10 ], b => { c => d }, }); # $flat = { # 'a.0' => 7, # 'a.1' => 8, # 'a.2' => 9, # 'a.3' => 10, # 'b.c' => 'd' # };
This module converts a nested Perl data structure into a one level hash of keys and values apt for human consumption.
Constructor. Initializes the flattener object
Returns a hashref for $struct which contains keys with dotted "paths" to the respective values in the datastructure.
The source code is located here: https://github.com/pplu/datastruct-flat
Hash::Flatten
Copyright (c) 2019 by CAPSiDE
Apache 2.0
To install DataStruct::Flat, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DataStruct::Flat
CPAN shell
perl -MCPAN -e shell install DataStruct::Flat
For more information on module installation, please visit the detailed CPAN module installation guide.