http://qs321.pair.com?node_id=66979


in reply to Re: grepping
in thread grepping

Okay, question...@data has three variables $id, $name, $ref and @data2 has 5 variables $id, $name, $ref, $type, $owner.

{ my %data; undef @data{@data}; foreach ( @data2 ) { print "This $_ was not found.\n" if not exists $data{$_} } }

This code is matching all 5 variables in @data2 to all 3 variables in @data, thus returning every row in @data2. For a test I took out all but 1 variable from each row in each array and it returned the results I needed. How can I use this code to handle multiple variables or values? And what if I wanted to lookup $name instead of $id.

Thanks!