in reply to Empty List miracle(1)
Some people say that lists don't exist in scalar context (and I disagree, but that's really a pointless discussion), but if we assume they do exist, then the default behaviour of a list is scalar context is to return its last element:
print scalar(1, 2, 3);
prrint the 3.
(Update) and the last element of an empty list is not defined, which is why you get the warning.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Empty List miracle(1)
by ikegami (Patriarch) on Apr 30, 2010 at 14:19 UTC | |
|
Re^2: Empty List miracle(1)
by chromatic (Archbishop) on Apr 29, 2010 at 23:37 UTC | |
by moritz (Cardinal) on Apr 30, 2010 at 06:28 UTC | |
by chromatic (Archbishop) on Apr 30, 2010 at 07:29 UTC | |
by Anonymous Monk on Apr 30, 2010 at 09:39 UTC |