more useful options | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Everyone known why print (1+1)*2; doesn't work as newbies might expect. But there's a simple rule to understand it: if it looks like a funtion call then it is a function call.
But I came across another example today: It appears that the sort function is seeing "uniq" as the code block that defines sort critera. OK, I thought, lets make it "look like a function call": But nope, this still prints "0,0,1,2". To make it work I need to resort to: or some similar intusive builtin. This example probably just scratches the surface of some parser logic that I haven't correctly groked. Why doesn't the "if it looks like a function" rule work in this case? If a builtin like "grep" (or "map") isn't treated as a sort-criteria code block, then how do I define my own subroutines that similarly are not sort-critera?
--Dave Opinions my own; statements of fact may be in error. In reply to When is a function call not a function call by dpuu
|
|