You can take advanntage of the fixed width property with unpack and validate the data afterwards.
# 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
The unpack width enforces the field width you expect. If spaces can't occur between digits, it becomes even simpler. The matching regex would then be
/^(\d+)$/. 'A
n' is the unpack template for a space-padded field of bytes and results in stripping the trailing spaces. In the regex,
[\d ] is a character class of digits and spaces.
Update: Simplified the code to agree with leriksen's spec.