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.
In reply to Re^3: compare values within hash
by toolic
in thread compare values within hash
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |