in reply to Declaring with my, assigning, and testing in same line

It's the scoping of the parentheses around the my assignment that causes the problem.

The parens have nothing to do with it. A 'my' declaration has no effect until the statement after the 'my'. This is, at least in part, so you can do:

my $x = 2; { my $x = 3 * $x; # $x == 6 } # $x == 2

As to your question, you can get away with:

(@$_ = keys %foo) == 1 or die "Got more than one: @$_\n" for \my @v;

But I'm not sure it is worth it.

- tye