# Given $record my %record; @record{ qw/account address info/ } = unpack 'A20 A42 A255', $record; # adjust widths to suit # ($record{'account'}) = $record{'account'} =~ /^(\d[\d ]*)$/ ($record{'account'}) = $record{'account'} =~ /^(\d+)$/ or die 'Bad Account ID'; # detaints, too # verify the rest