Your problem is, actually, that
[tt]${$pcode_fixed_length}[/tt]
should be
[tt]${pcode_fixed_length}[/tt]
The former is trying to take the contents of [tt]$pcode_fixed_length[/tt] as a scalar reference, and dereference it into the actual scalar. Since it's not, actually, a reference to a scalar, it's just giving you nothing. This is making your sprintf turn out to be:
[tt]sprintf "%-s", $postcode;[/tt]