johnirl has asked for the wisdom of the Perl Monks concerning the following question:
my %hash ={"var1", "info1", "var2", "info2", "var3", "info3"}; my @array=("var1","var2","var3"); my $where = "var1"; my $used = 0; foreach my $item(@array){ if ($item eq $where) { push @result_array, $hash{$item}; $used = 1; } } unless ($used = 1){ push @result_array, $where; } $used = 0;
Thanks everybody
j o h n i r l .
Sum day soon I'Il lern how 2 spelI (nad tYpe)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Variable Selection
by tommyw (Hermit) on Aug 30, 2002 at 10:06 UTC | |
|
Re: Variable Selection
by fruiture (Curate) on Aug 30, 2002 at 10:04 UTC | |
|
Re: Variable Selection
by Preceptor (Deacon) on Aug 30, 2002 at 10:04 UTC |