in reply to Re: Defining an anonymous hash with slices and lists.
in thread Defining an anonymous hash with slices and lists.
my %hash; @hash{ qw/ one two three / } = ( 1..3 );
And if you don't care about strictures, the my %hash; part can even be eliminated.
The problem comes when trying to pluck one of its values while defining it, like this:
$someval = ${@hash{ qw/ one two three / } = ( 1..3 )}{two};
And it only gets worse if you try to make it anonymous by removing the name "hash".
Dave
"If I had my life to do over again, I'd be a plumber." -- Albert Einstein
|
|---|