Top "Perl-data-structures" questions

Discussion of Perl's three built-in data types: scalars, arrays of scalars, and associative arrays of scalars, known as "hashes". At your command-line: perldoc perldata

Sort by value hash of hash of hashes Perl

I have a hash structure similar to the following: KeyA => { Key1 => { Key4 => 4 Key5 => 9 Key6 => 10 } Key2 =&…

perl sorting hash perl-data-structures
Perl Array References and avoiding "Type of arg 1 to keys must be hash" error

I have a scalar $subscribers that could be undef, reference to a HASH, or reference to an ARRAY. I have …

arrays perl hash ref perl-data-structures
How do I create an array of hashes and loop through them in Perl?

I'm trying to create an array of hashes, but I'm having trouble looping through the array. I have tried this …

arrays perl hash perl-data-structures
Perl: Sorting 2D array with multiple columns based on a particular column

Pseudo code: my @unsortedArray = { ["Harry", 10], ["Tim", 8], ["Joe", 3]}; my @sortedArray = ????? Final sortedArray should be sorted based on col-2 (integers), taking care …

arrays perl perl-data-structures
Is it possible to iterate through a hash in sorted order using the while(my($key, $value) ... ) {} method?

For a hash of this format: my $itemHash = { tag1 => { name => "Item 1", order => 1, enabled => 1, }, tag2 => { name =&…

perl perl-data-structures
Search for hash in an array by value

I have a function which extracts Excel data into an array of hashes like so: sub set_exceldata { my $excel_…

arrays perl hash perl-data-structures
Dynamically/recursively building hashes in Perl?

I'm quite new to Perl and I'm trying to build a hash recursively and getting nowhere. I tried searching for …

perl hash recursion perl-data-structures