Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Greate Monks,
I have Arrays, Hash and scalar. I should find the word "tiger" in all the arrays, hash, scalar.
Please suggest me in short way
I tried:
@array_1 = ("cat", "rat", "lion"); @array_2 =("dog", "tiger"); $variable="horse"; %hash=("1" => 'peacock', "2" => 'duck') ; foreach (@array_1) { if ($_ eq "tiger") { print "\nfound $_"; } } foreach (@array_2) { if ($_ eq "tiger") { print "\nfound $_"; } }
etc ...
I think its too long.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Find the word in Array, Hash, Scalar
by gopalr (Priest) on May 11, 2005 at 09:03 UTC | |
by Animator (Hermit) on May 11, 2005 at 09:46 UTC | |
by Forsaken (Friar) on May 11, 2005 at 09:11 UTC | |
|
Re: Find the word in Array, Hash, Scalar
by astroboy (Chaplain) on May 11, 2005 at 10:48 UTC | |
|
Re: Find the word in Array, Hash, Scalar
by Roy Johnson (Monsignor) on May 11, 2005 at 11:50 UTC | |
|
Re: Find the word in Array, Hash, Scalar
by kprasanna_79 (Hermit) on May 11, 2005 at 09:26 UTC |