hotyopa has asked for the wisdom of the Perl Monks concerning the following question:
I have a hash:
and an array: my @employee = ('PL', 'VB', 'C'); What I want to do is come up with an array containing those unmatched keys from the hash. That is, in my example:my %languages = ( ASM => 'Assembler', PL => 'Perl', C => 'C', JV => 'Java', VB => 'Visual Basic', DLP => 'Delphi', );
my @result = ('ASM', 'JV', 'DLP');
I'm looking for a smart way to achieve this. I could do it with a loop and compare type thing, but am sure there is a clever and better way to do it.(Background info: it's for a HRM skills database. I've read in the skill records for an employee, and want to put a text box at the top of the form from which they can add a new skill to their records).
*~-}hotyopa{-~*
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Find unmatched between an array and a hash
by japhy (Canon) on Feb 07, 2001 at 06:06 UTC | |
|
Re: Find unmatched between an array and a hash
by Fastolfe (Vicar) on Feb 07, 2001 at 05:49 UTC | |
|
Re: Find unmatched between an array and a hash
by eg (Friar) on Feb 07, 2001 at 05:46 UTC | |
by merlyn (Sage) on Feb 07, 2001 at 06:16 UTC | |
by tye (Sage) on Feb 07, 2001 at 10:10 UTC |