Assign method call to hash value?
Peter Corlett
abuse at cabal.org.uk
Tue Jan 29 11:48:49 GMT 2013
On Tue, Jan 29, 2013 at 11:36:21AM +0000, gvim wrote:
[...]
> Yes, I'm aware of the scalar function but still not clear why assigning
> $r->method as a hash value doesn't invoke a scalar context in the first
> place.
Because creating an anonymous hash with { ... } imposes list context on its
contents. If it didn't, you wouldn't be able to, for example, conveniently do
$foo = { %$bar, blargh => 1 } to copy a hash while changing one key.
More information about the london.pm
mailing list