in reply to Re^2: Idiom to return 0 or random number of array elements
in thread Idiom to return 0 or random number of array elements
With $hash{...} a scalar context is imposed on the key. With a slice like @hash{...} list context is imposed on the key.
use 5.010; use strict; sub WA { return wantarray } my %hash = ('' => 'Hello ', '1' => 'World'); say $hash{ WA() }, @hash{ WA() };
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
|
---|
In Section
Seekers of Perl Wisdom