Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re^2: Looping through arrays : are they equal ?

by ZlR (Chaplain)
on Apr 23, 2011 at 13:12 UTC ( #900969=note: print w/replies, xml ) Need Help??

in reply to Re: Looping through arrays : are they equal ?
in thread Looping through arrays : are they equal ?

Thanks wind, this really saved the day :) I must say i copypasted it shamelessy into my script, given the deadlines i had ...

Now that i look at it, i see a couple of great things :

- the structure of %devs and the way it's built from %comp

- the way you "each" through %dev : $keys is a hash ref, (with the adresses of a device as keys). I need to 'each' more, when i have refs as values !

So, now, the grep. It's over the keys of refcomp, so $_ is an adress. Hence, if $keys->{$_} is not defined, it means that this device we are eaching on is missing for that adress. keys %comp has all adresses but keys %$keys only has the adress of a specific device.

Honestly, i would never have found that myself, the way it works for any number of adresses by 'reversing' the hash and looking at it from the device ... it's brilliant :D
It's also a very consistent way of looking at this specific system conf giving me a complete 'for sure' list of errors. Thanks !!

  • Comment on Re^2: Looping through arrays : are they equal ?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://900969]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (8)
As of 2018-06-17 22:49 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (107 votes). Check out past polls.