http://www.perlmonks.org?node_id=493517


in reply to Re^2: Shortcut operator for $a->{'b'}=$b if $b;
in thread Shortcut operator for $a->{'b'}=$b if $b;

foreach loops sets $_ to refer to the current value in the list which is being iterated. In this case, the list consists solely of $b.

Your expression is equivalent, but it's not an acceptable answer since the question was about removing the need for using $b twice.