Tie::Hash::StackTie::Hash::Stack is a Perl module which maintains an array of hashes like a stack. | |
Download |
Tie::Hash::Stack Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Michael K. Neylon
- Publisher web site:
- http://search.cpan.org/~dmuey/Hash-Merge-0.10/Merge.pm
Tie::Hash::Stack Tags
Tie::Hash::Stack Description
Tie::Hash::Stack is a Perl module which maintains an array of hashes like a stack. Tie::Hash::Stack is a Perl module which maintains an array of hashes like a stack.SYNOPSIS use Tie::Hash::Stack qw(pop_hash push_hash merge_hash); my %hash; tie( %hash, "Tie::Hash::Stack" ); # Ties the hash $hash{ 1 } = "one"; $hash{ 2 } = "two"; $hash{ 3 } = "three"; push_hash %hash; # Pushes a new hash on the stack $hash{ 2 } = "II"; # $hash{ 2 } now 'II' $hash{ 4 } = "IV"; push_hash %hash; $hash{ 3 } = "9/3"; # $hash{ 3 } now '9/3' $hash{ 5 } = "10/2"; pop_hash %hash; # $hash{ 3 } now 'three'; delete $hash{ 2 }; # $hash{ 2 } now undef'ed; my %merged = merge_hash %hash; # ( 1=>one, 3=>three, 4=>IV )Tie::Hash::Stack allows one to tie a hash to a data structure that is composed of an ordered (FILO) sequence of hashes; hash values are always set on the newest hash of the stack, and are retrieved from the hash that contains the requested that is newest on the stack. The stack can be manipulated to add or remove these hashes. This type of structure is good when one is collecting data in stages with the possibility of having to "back up" to previous stages. Requirements: · Perl
Tie::Hash::Stack Related Software