Array::AsHashTreat arrays as a hashes, even if you need references for keys | |
Download |
Array::AsHash Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Curtis Poe
- Publisher web site:
- http://search.cpan.org/~ovid/
Array::AsHash Tags
Array::AsHash Description
Treat arrays as a hashes, even if you need references for keys Sometimes we have an array that we need to treat as a hash. We need the data ordered, but we don't use an ordered hash because it's already an array. Or it's just quick 'n easy to run over array elements two at a time. Array::AsHash is a Perl module that allows you to use the array as a hash but also mostly still use it as an array, too.Because we directly use the reference you pass to the constructor, you may wish to copy your data if you do not want it altered (the data are not altered except through the publicly available methods of this class).SYNOPSIS use Array::AsHash; my $array = Array::AsHash->new({ array => \@array, clone => 1, # optional }); while (my ($key, $value) = $array->each) { # sorted ... } my $value = $array->get($key); $array->put($key, $value); if ( $array->exists($key) ) { ... } $array->delete($key); Requirements: · Perl
Array::AsHash Related Software