in reply to Re^7: Using exists to check element in array
in thread Using exists to check element in array
| VAR / VARELEM | @a / $a[$i] | %h / $h{$k} |
|---|---|---|
| VARELEM = 1 | May add multiple elements to the array. | Adds at most one element to the hash. |
| VAR in list context | The value of each element. | The key and value of each element. |
| VAR in scalar context | The number of elements. | |
| keys(VAR) in list context | The key of each element. | |
| keys(VAR) in scalar context | The number of elements. | |
| values(VAR) | The value of each element. | |
| each(VAR) | All elements. | |
| exists(VARELEM) | False if the element isn't in array. False if it's in the array and the underlying pointer is NULL. True if it's in the array and the underlying pointer isn't NULL. | False if the element isn't in hash. True if it is in the hash. |
| delete(VARELEM) | Sets the element to undef by setting the underlying pointer to NULL. Removes the element from the array if it's the last one. | Removes the element from the hash. |
|
|---|