Welcome to the Monastery | |
PerlMonks |
Re: Context tutorialby ikegami (Patriarch) |
on Jan 25, 2009 at 04:09 UTC ( [id://738748]=note: print w/replies, xml ) | Need Help?? |
Then how come Example 4 is
and not
I've never see assigning to an empty list used to force a list context. Assigning to an empty list is used to count the number of elements in a list (which has nothing to do with context). In the case of badly written code, assigning to the empty list can differentiate between void and list context, but it never makes sense to use it to differentiate between scalar and list context as you show. To force list context, one adds parens around the LHS of the assignment or use a list slice.
Update: Added example.
In Section
Tutorials
|
|