in reply to Error: Uninicialized Value

Look at what my @flds = split '\|', $line; is doing with the lines whose last two fields are empty, e.g. |3104|1|New Years|Holiday|Clinic|||
Unfortunately, it does not return zero-length strings for trailing empty fields, as it ought to (and, I thought, used to).
Instead, it doesn't return them at all; @flds is shorter by two.
So you get undef when you try to access the fields at those indices.

A word spoken in Mind will reach its own level, in the objective world, by its own weight

Replies are listed 'Best First'.
Re^2: Error: Uninicialized Value (-1)
by tye (Sage) on Apr 29, 2008 at 18:11 UTC

    If you don't want trailing empty values stripped, then use split '\|', $line, -1; as documented at split.

    - tye