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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.