Hello kcott,
I considered using scalar too, but then the comma operator returns the right-most value in the list, which doesn’t seem to be what the OP is looking for:
19:53 >perl -MData::Dump -wE "sub f { return (17, 42); } my %h = ( key +1 => scalar f() ); dd \%h;" { key1 => 42 } 19:54 >
Cheers,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re^2: Preventing unintended list expansion inside hash literals.
by Athanasius
in thread Preventing unintended list expansion inside hash literals.
by gregory-nisbet
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |