in reply to Re^2: Newbie: uses/limits of perl in editing files
in thread Newbie: uses/limits of perl in editing files

BOBBY X66666 A 345 674 A 123 488

Assuming the piece you want to replace is the 2nd token in the line then you can do something like:

s/^(\S+)(\s+)(\S+)(.*)/${1}${2}B22222${4}/;

This reads like:
(NOT WHITESPACE)(WHITESPACE)(NOT WHITESPACE)(EVERYTHING)

That collects the first 3 pieces into variables $1-$3 then the remainder of the line into $4, then reassemblies the line with the pieces and the replacement.