On Thu, 4 Oct 2012 17:26:23 +0100
jet speed <speedj...@googlemail.com> wrote: 
> I am trying to find the array elements in hash, if it matches then
> print the hash value. Please help me to achieve this.
> 
> Note: array elements matches the first 2 characters of the hash keys.
> 
> 
> @match = ("6c7b00", "6d7b00", "6d9d8f", "6c6863", "6e6632");
> %abc = ('6c' => device1, '6d'=>device5, '6e'=>device3, '6g'=>device9);
> 
> 
> Appreciate your help with this.

What have you tried so far?  Where did you get stuck?

Hint: it should be pretty easy to loop over @match, use substr() to get
the first two chars, then look for that key in the hash.



-- 
David Precious ("bigpresh") <dav...@preshweb.co.uk>
http://www.preshweb.co.uk/     www.preshweb.co.uk/twitter
www.preshweb.co.uk/linkedin    www.preshweb.co.uk/facebook
www.preshweb.co.uk/cpan        www.preshweb.co.uk/github



-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to