Perl doesn't have a list data type but list operators.
The scalar comma operator returns the last element.
An empty list in scalar context is undef.°
HTH
> The differences between split and a normal subroutine should be clarified.
a default subroutine has no prototype, split has.
(Still, there are anormal functions without simple prototype )
Sorry split is one of those built-ins without reproducible prototype, hence it's more complex:
DB<4> x prototype "CORE::push" 0 '\\@@' DB<5> x prototype "CORE::split" 0 undef
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
°) you seem to belive that naked parentheses impose list context and create a list value, but they are only grouping precedence !
... see List's terminology and Parentheses in Perl for details.
In reply to Re: Split does not behave like a subroutine
by LanX
in thread Split does not behave like a subroutine
by bojinlund
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |