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.
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!
{ 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!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Re: Re: grepping
by dws (Chancellor) on Mar 25, 2001 at 11:21 UTC | |
by Anonymous Monk on Mar 25, 2001 at 11:31 UTC | |
by dws (Chancellor) on Mar 25, 2001 at 11:37 UTC | |
by Anonymous Monk on Mar 25, 2001 at 12:36 UTC | |
by tilly (Archbishop) on Mar 26, 2001 at 01:52 UTC | |
by dws (Chancellor) on Mar 26, 2001 at 03:58 UTC |
In Section
Seekers of Perl Wisdom