if (! @times) presumably means if there is nothing in the array?
Yes. Alternatively you could use
unless (@times) { # ...
which may be clearer to understand naively, based on the rationale that a full thingy is true and an empty one is false.
This is a general confusion I have with perl, about what tests for a value being present in a variable and what "undef" means.
undef is a builtin function which can take a variable and give it a special value which is also its own return value. The latter is thus in turn also called undef: in fact the function is often used with no argument in which case it simply returns it. undef is a particular false value, precisely the one that also have variables which have not been initialized at all.
I assume the exclamation mark I can always use to determine if values are (not) present in a variable from now on?
The exclamation mark is simply a logical "not" that turns a true value into a false one and vice versa.
In reply to Re^3: array splitting
by blazar
in thread array splitting
by CColin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |