Commit a89351ac authored by Ricardo Signes's avatar Ricardo Signes Committed by Karen Etheridge

native traits: document contextual behavior of elements

parent 5395a999
......@@ -78,10 +78,13 @@ This method does not accept any arguments.
=item * B<elements>
Returns all of the elements of the array as an array (not an array reference).
In list context, returns all of the elements of the array as a list.
my @option = $stuff->all_options;
print "@options\n"; # prints "foo bar baz boo"
In scalar context, returns the number of elements in the array.
my @options = $stuff->all_options;
print "@options"; # prints "foo bar baz boo"
print scalar $stuff->all_options; # prints 4
This method does not accept any arguments.
......
......@@ -102,7 +102,10 @@ This method does not accept any arguments.
=head2 elements
Returns the key/value pairs in the hash as a flattened list..
In list context, this returns the key/value pairs in the hash.
In scalar context, this returns the count of keys plus values. In other words,
it's the same as L<keys> times two.
This method does not accept any arguments.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment