in reply to Re: Searching a database
in thread Searching a database
mystifies me - what is the split splitting? When split isn't given an arg to split, it splits $_, but what is $_ in this case, since the while loop gets $key and $value?foreach my $num (split /::/ => $value) {
I'm not entirely sure I understand the original intent, so this solution may need some work.my %matches = map {$_ => 1} 17, 83, 114, 205, 407; while (my ($key, $value) = each %hash) { my @value_tokens = split /::/, $value; foreach my $value_token (@value_tokens) { if ($matches{$value_token}) { print "$key: $value\n"; $found = 1; last; ### break out of foreach } } ### end foreach if $found: next; } } ### end while
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Searching a database
by Abigail-II (Bishop) on Sep 12, 2003 at 13:35 UTC |