O Wise Ones,
Is there a one-line way to do something along the lines of:
my $hash = {
key1 => 'value1',
key2 => 'value2',
};
my ($hash1, $hash2) = _insert_perl_magic_;
Such that then
$hash1 becomes
{key1 => 'value1'} and
$hash2 becomes
{key2 => 'value2'}?
The closest I've gotten is:
my @hashes = map { {$_ => $hash->{$_}} } qw(key1 key2);
my ($hash1, $hash2) = @hashes;
But it doesn't seem to work in one line (probably because of some lazy generation or something (I confess I don't truly understand how map works)