in reply to Re^2: compare values within hash
in thread compare values within hash
Using exists on array elements makes no sense.I disagree. It seems like the documentation to which you link also disagrees:
Given an expression that specifies a hash element or array element, returns true if the specified element in the hash or array has ever been initialized, even if the corresponding value is undefined.It clearly mentions "array"; I must be missing your point.
Here is what I was trying to accomplish. The OP has two arrays of different sizes. I decided to loop over the larger array (a1). In order to avoid a warning when checking the last element of a1 versus a non-existent element of the smaller array (a2), I decided to use exists. In my example, it Does What I Want.
Thanks for pointing out $i < @a2; I definitely prefer it to my usage of exists in this case.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: compare values within hash
by ikegami (Patriarch) on Nov 23, 2008 at 18:55 UTC |