Gunnar Hjalmarsson wrote:
Richard Lee wrote:
say I have @data which below was pushed(bunch of them) with below hash of hash refernce

$VAR1 = {
         'element' => {
                                 'element2' => 'now',
                                 'element3' => '2',
                                 'element4' => 'serverxxx',
                               }
               };

and then I would call sub do_it like
do_it(somevalue, $data)

sub do_it {
my $something = shift;
    for (@_) {
      foreach my $XX ( keys %_ ) {
if ( exists ( $XX->{ element }{ element2 } ) && $XX->{ element }{ element4} eq "$something" ) { for my $key ( keys %{ $XX{ element } } ) { <------ Global symbol "%XX" requires explicit package name <--------------------?????
                print "$key\n";
                print "$XX and $XX{ element}{$key}\n";
           }
        }
       }
}

why does it not like XX in above line ??

The above mix of English and Perl is confusing, and it's difficult to guess what you are trying to accomplish. You can't just introduce variables such as $data and %_, without showing how they were populated, and expect others to follow your line of thinking.

Please post a _complete_ program that we can copy and run, and that illustrates the issue you want help to resolve.


below is hash of hash?
how do I dereference them (all of them)?



$VAR1 = {
         'number' => {
                       'three' => '21',
                       'five' => '23',
                       'one' => 'number',
                       'two' => '20',
                       'four' => '22'
                     }
       };
$VAR2 = {
         'alpha' => {
                      'e' => '103',
                      'c' => '101',
                      'a' => 'alpha',
                      'b' => '100',
                      'd' => '102'
                    }
       };


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to