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.
In reply to Re^3: Shortcut operator for $a->{'b'}=$b if $b;
by ikegami
in thread Shortcut operator for $a->{'b'}=$b if $b;
by rokadave
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |