in reply to Re^2: Converting Column Into Row
in thread Converting Column Into Row

Or use Tie::IxHash on the data hash, before you start filling it.
use Tie::IxHash; tie %data, 'Tie::IxHash';

Tie::IxHash actually does pretty much the same thing as your code, under the hood.