use of undef

Tom Keller kellert at
Mon Jun 11 16:31:36 CDT 2001

Hi all,
I'm confused about the use of undef.
I want to count the number of elements in a list until the first undefined value.
I tried this:
@array = (0, 1, 2,  , "next", "group");
ELEMENTS: foreach $element (@array) {
      last ELEMENTS if $element eq undef;
It gives me the correct count, 3, and leaves the loop correctly, but I get a warning for each element.
What am I missing?

Tom Keller

More information about the Pdx-pm-list mailing list