Interestingly, the bug only works one way.
Code:
$j = $b[$a[1]]

works as expected