in reply to checking keys exist in 1 key:multiple value situation

The problem is with your data. What you might think are duplicate keys aren't really (the code which you showed would not do what you say, so $key must not be what you think it should be).

use Data::Dumper and print Dumper\%matrixhash to see what's actually in there. I'm guessing you have stray whitespace.


MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
** The Third rule of perl club is a statement of fact: pod is sexy.

  • Comment on Re: checking keys exist in 1 key:multiple value situation

Replies are listed 'Best First'.
Re: Re: checking keys exist in 1 key:multiple value situation
by basm101 (Acolyte) on Jan 30, 2003 at 11:45 UTC
    hmm..maybe it's a different problem then. I used Data::Dumper like suggested
    and it printed:

    $VAR1 = { 'NERME' => 1 }; where NERME is a key and the first value I shove into its array is 1.
    Is this typical Data::Dumper "show me the hash" output ? It's the first
    time I've tried using Data::Dumper.
    Thanks,

    basm101
      Yes, that is typical Data::Dumper output. Example
      #!/usr/bin/perl use Data::Dumper; use strict; use warnings; my %hashes = ( 1..4); push @{$hashes{z}}, 1..3; die Dumper\%hashes; __END__ $VAR1 = { '1' => 2, '3' => 4, 'z' => [ 1, 2, 3 ] };
      Please read the site how to and the perl monks faq, and format your post correctly (use <CODE></CODE> tags for code)


      MJD says you can't just make shit up and expect the computer to know what you mean, retardo!
      ** The Third rule of perl club is a statement of fact: pod is sexy.