Basically, undef is a keyword that takes an array.
Yes, but a slice is not an array, and undef is explicitly not
Undefines the value of EXPR, which must be an lvalue. Use only
on a scalar value, an array (using @ ), a hash (using % ), a
subroutine (using & ), or a typeglob (using * ).
Note that this is a unary operator, not a list operator.
What happens when you undef a slice is that it is converted into a list, which is then evaluated in scalar context, which yields the last element of the slice as the scalar value. That value (and only that value) is then set to undef (so it's not a no-op; if you want a no-op use the \ operator, which will take a list). Contrast that with handing it an array proper. The entire array is then undefined.
The conversion from hash slice to list to scalar is not documented, and should generate a warning. In fact, if you try to pass undef a list of array elements, you will get an error.
there is no such thing as a list in scalar context
Caution: Contents may have been coded under pressure.