in reply to Re^2: Read the lines until a string exists in the array
in thread Read the lines until a string exists in the array
How to read the data until the variable exists in an array
I guess you mean until the variable exists in a hash, because your question about testing the existence in an array was already answered. You can test whether a key exists in a hash using the - surprise, surprise! - exists function. If you want to know whether a certain value exist in the hash, use values, which gives you an array of the values, and see whether your string exists in that array.
BTW, your usage of the hash $ctr looks funny to me. As far I can see, your keys of the hash are just the numbers 1,2,3..., so from a usage point of view, your hash is not different from an array (only that you start counting by 1 instead of 0).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Read the lines until a string exists in the array
by Anonymous Monk on Aug 14, 2009 at 09:27 UTC | |
by rovf (Priest) on Aug 14, 2009 at 09:47 UTC | |
by Anonymous Monk on Aug 14, 2009 at 17:29 UTC | |
by chromatic (Archbishop) on Aug 14, 2009 at 18:46 UTC | |
by Anonymous Monk on Aug 14, 2009 at 19:48 UTC | |
|