in reply to Reading lines going by 2 characters at a time
$str =~ s/(\d) (\d)/frob($1, $2)/eg [download]
where you define a sub frob that turns two numbers into a single one, by the rules you've just described.