Perl: the Markov chain saw | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
The word "list" is often used. Often it is not clear to which list it refers. I don't normally think about lists in a way as complicated as you are here, but for initial learning that's probably fine (Update: to clarify: it's fine as a learning method). Personally, I think about "lists" in Perl as there being only one kind of list, and it's a somewhat loose term that can refer to argument lists (which the subroutine ends up seeing as an array), list value constructors, and return values. AFAICT, your description in your node seems to fit "lists" in general pretty well, so unfortunately I'm not quite sure what your specific question is here?
This list contains references to the argument values. Just to nitpick this, note that these are not "references" in the sense of hard references described in perlref. They are more commonly referred to as aliases. How or where can you find the restrictions on the arguments to split? There is a huge caveat to the "arguments to subs are flattened": Prototypes, which I suggest you read up on. These change the way the function call is parsed, and this can include forcing arguments that would normally be flattened / interpolated, like in your case @_[1,2], to in fact be taken as if they have an implicit scalar on them. Builtin functions can indeed sometimes be a little confusing in this respect, because they are parsed as with prototypes, even if the prototypes are never stated explicitly for many functions. In fact, the use of prototypes is otherwise generally discouraged because of their often confusing effects on how function calls are parsed, but in the Perl core I believe they have historic significance. The $ prototype is probably the closest equivalent to what's going on with split:
Minor typo fixes. In reply to Re^3: Split does not behave like a subroutine
by haukex
|
|