on Mon, 26 Aug 2002 11:47:00 GMT, [EMAIL PROTECTED] (Angerstein) 
wrote:

[blank lines trimmed]

> It a little bit misunderstandable...
> letīs say i got 100 hashes named after each of my routers.
> a list auf my routeres is in @allmyrouters.
> My hashes contains fileds: ip, interfaces, admin.

So, you would have:

my %thisrouter = ( ip         => '1.2.3.4',
                   interfaces => 'whatever',
                   admin      => 'whatevermore'
                 );

Or, as a hasref:

my $thisrouter = { ip         => '1.2.3.4',
                   interfaces => 'whatever',
                   admin      => 'whatevermore'
                 };



> I want to access each hashes field admin in a loop.
> How do i do that?

The idea is to create a hash of which the keys are you routernames, 
and the values are hashrefs with the above information.

my %allrouters = ( thisrouter => { ip         => '1.2.3.4',
                                   interfaces => 'whatever',
                                   admin      => 'whatevermore',
                                 },
                   thatrouter => { ip         => '5.6.7.8',
                                   interfaces => 'whateverevenmore',
                                   admin      => 'whateverigiveup',
                                 },
                 );


Then you can do:

        for my $r (keys %allrouters) {
            print "$r: $allrouters{$r}->{admin}\n";
     }


Believe me, you don't want to mess with symbolic references.

-- 
felix

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to