Puma
P e r l   U n i v e r s a l   M a r k u p   D o c u m e n t a t i o n
SourceForge.net Logo

Puma::Util::NCHash
The nchash() function is a combined object/hashtie that creates a hash with case insensitive keys.
   use Puma::Util::NCHash;
   use Data::Dumper;

   print "--- CREATE ---------------------------------------\n";
   my $nchash = nchash(create1 => 'one');
   $nchash->{CrEaTe2} = 'two';

   my $foo = Data::Dumper->Dump([$nchash->{_content}], ['create']);
   print Data::Dumper->Dump([$nchash], ['create']) ."\n";

   print "--- FIRSTKEY/NEXTKEY -----------------------------\n";
   foreach my $key (keys %$nchash) {
      my $lckey = lc($key);
      print "$lckey = $nchash->{$lckey} ($key)\n";
   }
produces the output:
   --- CREATE ---------------------------------------
   $create = bless( {
         'CrEaTe2' => 'two',
         'create1' => 'one'
      }, 'Puma::Util::NCHash' );

   --- FIRSTKEY/NEXTKEY -----------------------------
   create2 = two (CrEaTe2)
   create1 = one (create1)
Cool, huh?