in reply to Overview scalar vs list context?
G'day KurtZ,
"... overview of builtins and their corresponding return values."
Many functions return different values based on their context. A couple of examples:
$ perl -E 'say grep $_ => (0,1,1,1); say scalar grep $_ => (0,1,1,1)' 111 3 $ perl -E 'say localtime; say scalar localtime' 51491621411701400 Sun May 21 16:49:51 2017
So there isn't a one-to-one mapping between functions and return values. The important issue is to understand context itself. See "perldata: Context". Sorry if that sounds a bit blunt; however, without knowing in what way your "colleague is struggling", it's difficult to provide more specific help.
I don't recall ever seeing the "tabular overview" you mentioned.
"Looked into perlfunc and found only dispersed references.."
Yes, that's a large and unwieldy beast: I almost never use it! You may find the "Perl functions A-Z" is a lot easier to reference functions and find how they operate in different contexts: I use this regularly.
— Ken
|
|---|